Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.*;
- import java.awt.event.*;
- public class AwtTest extends Frame{
- public Panel createCalibrationPanel() {
- final Panel panel = new Panel();
- panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
- panel.add(Box.createHorizontalStrut(20));
- final Checkbox checkbox = new Checkbox(
- "Use image spatial calibration for q scale", true);
- final Button button = new Button("Set scale");
- //useCalibration = checkbox.getState();
- button.setEnabled(checkbox.getState());
- panel.add(checkbox);
- panel.add(button);
- checkbox.addItemListener(new ItemListener() {
- public void itemStateChanged(final ItemEvent e) {
- boolean state = checkbox.getState();
- //setUseCalibration(state);
- button.setEnabled(state);
- System.out.println("checkbox state " + checkbox.getState());
- }
- });
- button.addActionListener(new ActionListener() {
- public void actionPerformed(final ActionEvent e) {
- //imp.unlock();
- System.out.println("Set Scale...");
- //imp.lock();
- }
- });
- return panel;
- }
- public static void main(String[] a){
- AwtTest foo = new AwtTest();
- foo.add(foo.createCalibrationPanel());
- foo.setSize(200,200);
- foo.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement