Skip to content

Instantly share code, notes, and snippets.

@dljsjr
Created June 23, 2011 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dljsjr/1043807 to your computer and use it in GitHub Desktop.
Save dljsjr/1043807 to your computer and use it in GitHub Desktop.
An example of something that doesn't work on OS X for some reason (for the purposes of an SO link)
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JSlider;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
public class FrameExample extends JFrame
{
private JPanel contentPane;
private JTextField xAccelTextField;
/**
* Launch the application.
*/
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
FrameExample frame = new FrameExample();
frame.setVisible(true);
} catch (Exception e)
{
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public FrameExample()
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JSlider xAccelSlider = new JSlider();
xAccelSlider.setMaximum(15);
xAccelSlider.setBounds(0, 19, 190, 29);
contentPane.add(xAccelSlider);
JLabel xAccelLabel = new JLabel("Linear Acceleration along X");
xAccelLabel.setBounds(6, 6, 184, 16);
contentPane.add(xAccelLabel);
xAccelTextField = new JTextField();
xAccelTextField.setEditable(false);
xAccelTextField.setText("0");
xAccelTextField.setBounds(187, 20, 134, 28);
contentPane.add(xAccelTextField);
xAccelTextField.setColumns(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment