public ChannelSelectorOverlay(final ChannelControl cControl) { super(new BorderLayout()); this.cControl = cControl; nChannels = cControl.nChannels; // Panel with "All" and "None" Buttons in NORTH of this control. allNonePanel = new Panel(new GridLayout(1, 2)); allButton = new Button("All"); allButton.addActionListener(this); allNonePanel.add(allButton); noneButton = new Button("None"); noneButton.addActionListener(this); allNonePanel.add(noneButton); add(allNonePanel, BorderLayout.NORTH); addKeyListener(win); allButton.addKeyListener(win); noneButton.addKeyListener(win); // Pass key hits on to ImageJ addKeyListener(ij); allButton.addKeyListener(ij); noneButton.addKeyListener(ij); addKeyListener(win); allButton.addKeyListener(win); noneButton.addKeyListener(win); buildChannelSelector(); }
private Button addButton(String label) { final Button b = new Button(" "+label+" "); b.addActionListener(this); b.addKeyListener(this); panel.add(b); return b; }
void addButton(String label) { Button b = new Button(label); b.addActionListener(this); b.addKeyListener(IJ.getInstance()); b.addMouseListener(this); if (label.equals(moreButtonLabel)) moreButton = b; panel.add(b); }
void addButton(String label) { Button b = new Button(label); b.addActionListener(this); b.addKeyListener(IJ.getInstance()); b.addMouseListener(this); if (label.equals(moreButtonLabel)) moreButton = b; panel.add(b); }
/** * Add button to the dialog * @param label button label * @param listener listener to handle the action when pressing the button */ public void addButton(String label, ActionListener listener) { if (isHeadless()) return; Button button = new Button(label); button.addActionListener(listener); button.addKeyListener(this); addComponent(button); }
public void addFileField(String label, String defaultPath, int columns) { addStringField(label, defaultPath, columns); if (isHeadless()) return; TextField text = (TextField)stringField.lastElement(); GridBagLayout layout = (GridBagLayout)getLayout(); GridBagConstraints constraints = layout.getConstraints(text); Button button = new Button("Browse..."); FileListener listener = new FileListener("Browse for " + label, text); button.addActionListener(listener); button.addKeyListener(this); Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(text); panel.add(button); layout.setConstraints(panel, constraints); add(panel); }
public static void addSaveAsFileField( final GenericDialogPlus dialog, final String label, final String defaultPath, final int columns) { dialog.addStringField( label, defaultPath, columns ); final TextField text = ( TextField ) dialog.getStringFields().lastElement(); final GridBagLayout layout = ( GridBagLayout ) dialog.getLayout(); final GridBagConstraints constraints = layout.getConstraints( text ); final Button button = new Button( "Browse..." ); final ChooseXmlFileListener listener = new ChooseXmlFileListener( text ); button.addActionListener( listener ); button.addKeyListener( dialog ); final Panel panel = new Panel(); panel.setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) ); panel.add( text ); panel.add( button ); layout.setConstraints( panel, constraints ); dialog.add( panel ); }
public void addDirectoryOrFileField(String label, String defaultPath, int columns) { addStringField(label, defaultPath, columns); if (isHeadless()) return; TextField text = (TextField)stringField.lastElement(); GridBagLayout layout = (GridBagLayout)getLayout(); GridBagConstraints constraints = layout.getConstraints(text); Button button = new Button("Browse..."); DirectoryListener listener = new DirectoryListener("Browse for " + label, text, JFileChooser.FILES_AND_DIRECTORIES); button.addActionListener(listener); button.addKeyListener(this); Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(text); panel.add(button); layout.setConstraints(panel, constraints); add(panel); }
public static void addBrowseToCellVoyagerFolder( final GenericDialogPlus dialog, final String label, final String defaultPath, final int columns ) { dialog.addStringField( label, defaultPath, columns ); final TextField text = ( TextField ) dialog.getStringFields().lastElement(); final GridBagLayout layout = ( GridBagLayout ) dialog.getLayout(); final GridBagConstraints constraints = layout.getConstraints( text ); final Button button = new Button( "Browse..." ); final ChooseCellVoyagerDirListener listener = new ChooseCellVoyagerDirListener( text ); button.addActionListener( listener ); button.addKeyListener( dialog ); final Panel panel = new Panel(); panel.setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) ); panel.add( text ); panel.add( button ); layout.setConstraints( panel, constraints ); dialog.add( panel ); }
public void addDirectoryField(String label, String defaultPath, int columns) { addStringField(label, defaultPath, columns); if (isHeadless()) return; TextField text = (TextField)stringField.lastElement(); GridBagLayout layout = (GridBagLayout)getLayout(); GridBagConstraints constraints = layout.getConstraints(text); Button button = new Button("Browse..."); DirectoryListener listener = new DirectoryListener("Browse for " + label, text); button.addActionListener(listener); button.addKeyListener(this); Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(text); panel.add(button); layout.setConstraints(panel, constraints); add(panel); }
public static void addSaveAsFileField( final GenericDialogPlus dialog, final String label, final String defaultPath, final int columns) { dialog.addStringField( label, defaultPath, columns ); if ( isHeadless() ) return; final TextField text = ( TextField ) dialog.getStringFields().lastElement(); final GridBagLayout layout = ( GridBagLayout ) dialog.getLayout(); final GridBagConstraints constraints = layout.getConstraints( text ); final Button button = new Button( "Browse..." ); final ChooseXmlFileListener listener = new ChooseXmlFileListener( text ); button.addActionListener( listener ); button.addKeyListener( dialog ); final Panel panel = new Panel(); panel.setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) ); panel.add( text ); panel.add( button ); layout.setConstraints( panel, constraints ); dialog.add( panel ); }
public static void addSaveAsDirectoryField( final GenericDialogPlus dialog, final String label, final String defaultPath, final int columns) { dialog.addStringField( label, defaultPath, columns ); if ( isHeadless() ) return; final TextField text = ( TextField ) dialog.getStringFields().lastElement(); final GridBagLayout layout = ( GridBagLayout ) dialog.getLayout(); final GridBagConstraints constraints = layout.getConstraints( text ); final Button button = new Button( "Browse..." ); final ChooseDirectoryListener listener = new ChooseDirectoryListener( text ); button.addActionListener( listener ); button.addKeyListener( dialog ); final Panel panel = new Panel(); panel.setLayout( new FlowLayout( FlowLayout.LEFT, 0, 0 ) ); panel.add( text ); panel.add( button ); layout.setConstraints( panel, constraints ); dialog.add( panel ); }
button = new Button(" OK "); button.addActionListener(this); button.addKeyListener(this); c.insets = new Insets(2, 6, 6, 6); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.EAST;
public void showDialog() { yes = new Button(" Yes "); yes.setFont(font); yes.addActionListener(this); yes.addKeyListener(this); no = new Button(" No "); no.setFont(font); no.addActionListener(this); no.addKeyListener(this); Panel panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.CENTER,0,0)); panel.add(yes); panel.add(no); add("Center",panel); panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.CENTER,0,5)); add("South",panel); pack(); if (topleft != null) setLocation(topleft); else GUI.center(this); setResizable(true); setVisible(true); }
yesB.addKeyListener(this); noB.addKeyListener(this); if (IJ.isMacintosh()) { panel.add(noB);
button.setFont(font); button.addActionListener(this); button.addKeyListener(this); panel = new Panel(); panel.setLayout(new FlowLayout(FlowLayout.CENTER,0,0));
public LoginDialog() { super("Naked Objects Login"); AWTUtilities.addWindowIcon(this, "login-logo.png"); setLayout(new GridLayout(3, 2, 10, 10)); setResizable(false); add(new Label("User name:", Label.LEFT)); add(user = new TextField()); user.addKeyListener(this); add(new Label("Password:", Label.LEFT)); add(password = new TextField()); password.addKeyListener(this); password.setEchoChar('*'); add(cancel = new Button(CANCEL_LABEL)); cancel.addActionListener(this); cancel.addKeyListener(this); add(login = new Button(LOGIN_LABEL)); login.addActionListener(this); login.addKeyListener(this); pack(); final int width = getSize().width; // getWidth(); final int height = getSize().height; // getHeight(); final Dimension screen = getToolkit().getScreenSize(); int x = (screen.width / 2) - (width / 2); if ((screen.width / screen.height) >= 2) { x = (screen.width / 4) - (width / 2); } final int y = (screen.height / 2) - (height / 2); setLocation(x, y); user.requestFocus(); }
public LoginDialog() { super("Naked Objects Login"); AWTUtilities.addWindowIcon(this, "login-logo.png"); setLayout(new GridLayout(3, 2, 10, 10)); setResizable(false); add(new Label("User name:", Label.LEFT)); add(user = new TextField()); user.addKeyListener(this); add(new Label("Password:", Label.LEFT)); add(password = new TextField()); password.addKeyListener(this); password.setEchoChar('*'); add(cancel = new Button(CANCEL_LABEL)); cancel.addActionListener(this); cancel.addKeyListener(this); add(login = new Button(LOGIN_LABEL)); login.addActionListener(this); login.addKeyListener(this); pack(); int width = getSize().width; // getWidth(); int height = getSize().height; // getHeight(); Dimension screen = getToolkit().getScreenSize(); int x = (screen.width / 2) - (width / 2); if ((screen.width / screen.height) >= 2) { x = (screen.width / 4) - (width / 2); } int y = (screen.height / 2) - (height / 2); setLocation(x, y); user.requestFocus(); }
public ShutdownDialog(final ViewerFrame owner) { super(owner, "Naked Objects", true); //AWTUtilities.addWindowIcon(this, "shutdown-logo.gif"); setLayout(new GridLayout(2, 3, 10, 10)); add(new Label("Exit Naked Objects?", Label.LEFT)); add(new Panel()); add(new Panel()); add(new Panel()); add(quit = new Button(QUIT_LABEL)); quit.addActionListener(this); quit.addKeyListener(this); add(cancel = new Button(CANCEL_LABEL)); cancel.addActionListener(this); cancel.addKeyListener(this); pack(); int width = getSize().width; // getWidth(); int height = getSize().height; // getHeight(); Dimension screen = owner.getSize(); Point point = owner.getLocation(); int x = point.x + (screen.width / 2) - (width / 2); int y = point.y + (screen.height / 2) - (height / 2); setLocation(x, y); show(); quit.requestFocus(); addWindowListener(new WindowAdapter() { public void windowClosing(final WindowEvent e) { dispose(); } }); }
quit.addKeyListener(this); cancel.addKeyListener(this);