Java Code Examples for javax.swing.JButton

The following are top voted examples for showing how to use javax.swing.JButton. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: InstallerTest.java   Source Code and License 7 votes vote down vote up
public void inEQtestReadListOfSubmitButtons() throws Exception {
    String page = "<html><body><form action='http://xyz.cz' method='POST'>" +
        "<input type='hidden' name='submit' value=\"Send Feedback\"/>" +
        "\n" +
        "</form></body></html>";
    
    InputStream is = new ByteArrayInputStream(page.getBytes());
    JButton def = new JButton("Default");
    Object[] buttons = parseButtons(is, def);
    is.close();
    
    assertNotNull("buttons parsed", buttons);
    assertEquals("Second is default", def, buttons[1]);
    assertEquals("There is one button", 2, buttons.length);
    assertEquals("It is a button", JButton.class, buttons[0].getClass());
    JButton b = (JButton)buttons[0];
    assertEquals("It is named", "Send Feedback", b.getText());
    assertEquals("It url attribute is set", "http://xyz.cz", b.getClientProperty("url"));
}
 
Example 2
Project: incubator-netbeans   File: TerminalSupportImpl.java   Source Code and License 7 votes vote down vote up
public static Component getToolbarPresenter(Action action) {
    JButton button = new JButton(action);
    button.setBorderPainted(false);
    button.setOpaque(false);
    button.setText(null);
    button.putClientProperty("hideActionText", Boolean.TRUE); // NOI18N
    Object icon = action.getValue(Action.SMALL_ICON);
    if (icon == null) {
        icon = ImageUtilities.loadImageIcon("org/netbeans/modules/dlight/terminal/action/local_term.png", false);// NOI18N
    }
    if (!(icon instanceof Icon)) {
        throw new IllegalStateException("No icon provided for " + action); // NOI18N
    }
    button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon) icon));
    return button;
}
 
Example 3
Project: Progetto-A   File: PartitaOfflineGuiView.java   Source Code and License 6 votes vote down vote up
private void inizializzaExitButton() {
    esci = new JButton(caricaImmagine("dominio/immagini/esci.png"));
    esci.setBounds(35, 600, 96, 58);
    esci.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                audio.ferma("soundTrack");
                audio.riavvolgi("soundTrack");
            } catch (CanzoneNonTrovataException ex) {
                ex.printStackTrace();
            }
            menu_pre_partita.setVisible(true);
            dispose();
        }
    });
}
 
Example 4
Project: incubator-netbeans   File: Reset.java   Source Code and License 6 votes vote down vote up
boolean show () {
    panel.rbSoft.addActionListener(this);
    panel.rbMixed.addActionListener(this);
    panel.rbHard.addActionListener(this);
    
    okButton = new JButton(NbBundle.getMessage(Reset.class, "LBL_Reset.OKButton.text")); //NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
    dd = new DialogDescriptor(panel, NbBundle.getMessage(Reset.class, "LBL_Reset.title"), true,  //NOI18N
            new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(Reset.class), null);
    revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange (PropertyChangeEvent evt) {
            if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
                setRevisionValid(Boolean.TRUE.equals(evt.getNewValue()));
            }
        }
    });
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    validate();
    d.setVisible(true);
    return okButton == dd.getValue();
}
 
Example 5
Project: incubator-netbeans   File: RunTargetsAction.java   Source Code and License 6 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    String title = NbBundle.getMessage(RunTargetsAction.class, "TITLE_run_advanced");
    AdvancedActionPanel panel = new AdvancedActionPanel(project, allTargets);
    DialogDescriptor dd = new DialogDescriptor(panel, title);
    dd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
    JButton run = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_run"));
    run.setDefaultCapable(true);
    JButton cancel = new JButton(NbBundle.getMessage(RunTargetsAction.class, "LBL_run_advanced_cancel"));
    dd.setOptions(new Object[] {run, cancel});
    dd.setModal(true);
    Object result = DialogDisplayer.getDefault().notify(dd);
    if (result.equals(run)) {
        try {
            panel.run();
        } catch (IOException x) {
            AntModule.err.notify(x);
        }
    }
}
 
Example 6
Project: HBaseClient   File: SubmitActionListener.java   Source Code and License 6 votes vote down vote up
public void keyReleased(KeyEvent e)
{
	if ( e.getKeyChar() == '\n' )
	{
		((JButton)e.getSource()).doClick();
	}
}
 
Example 7
Project: VASSAL-src   File: ServerAddressBook.java   Source Code and License 6 votes vote down vote up
protected void addAdditionalControls(JComponent c, boolean enabled) {
  jabberHost.setEditable(enabled);
  jabberPort.setEditable(enabled);
  jabberUser.setEditable(enabled);
  jabberPw.setEditable(enabled);
  c.add(new JLabel(Resources.getString("ServerAddressBook.jabber_host"))); //$NON-NLS-1$
  c.add(jabberHost, "wrap, grow, push"); //$NON-NLS-1$
  c.add(new JLabel(Resources.getString("ServerAddressBook.port"))); //$NON-NLS-1$
  c.add(jabberPort, "wrap, grow, push"); //$NON-NLS-1$
  c.add(new JLabel(Resources.getString("ServerAddressBook.user_name"))); //$NON-NLS-1$
  c.add(jabberUser, "wrap, grow, push"); //$NON-NLS-1$
  c.add(new JLabel(Resources.getString("ServerAddressBook.password"))); //$NON-NLS-1$
  c.add(jabberPw, "wrap, grow, push"); //$NON-NLS-1$

  testButton = new JButton(Resources.getString("ServerAddressBook.test_connection")); //$NON-NLS-1$
  testButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      test();
    }
  });
  c.add(testButton, "span 2, align center, wrap"); //$NON-NLS-1$
}
 
Example 8
Project: SE2Project   File: RueckgabeUI.java   Source Code and License 6 votes vote down vote up
/**
 * Erzeuge den Rücknahme-Button.
 */
private void erzeugeRuecknahmeButton()
{
    JPanel buttonPanel = new JPanel();
    _ruecknahmePanel.add(buttonPanel, BorderLayout.SOUTH);
    buttonPanel.setPreferredSize(new java.awt.Dimension(-1, 110));
    buttonPanel.setSize(-1, -1);
    buttonPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    _ruecknahmeButton = new JButton();
    buttonPanel.add(_ruecknahmeButton);
    _ruecknahmeButton.setText("zurücknehmen");
    _ruecknahmeButton.setPreferredSize(new java.awt.Dimension(140, 100));
    _ruecknahmeButton.setSize(-1, -1);
    _ruecknahmeButton.setEnabled(false);
    _ruecknahmeButton.setFont(UIConstants.BUTTON_FONT);
}
 
Example 9
Project: JITRAX   File: NewDatabaseDialog.java   Source Code and License 6 votes vote down vote up
public NewDatabaseDialog() {
	newDatabaseNameField = new JTextField();
	nextButton = new JButton("NEXT");
	newDatabaseNameField.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	
	setLayout(new BorderLayout());
	
	EmptyBorder padding = new EmptyBorder(5, 5, 5, 5);
	JPanel textFieldPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	
	textFieldPanel.setBorder(padding);
	buttonsPanel.setBorder(padding);
	
	textFieldPanel.add(new JLabel("DB name: "));
	textFieldPanel.add(newDatabaseNameField);
	buttonsPanel.add(nextButton);
	
	add(textFieldPanel, BorderLayout.NORTH);
	add(buttonsPanel, BorderLayout.SOUTH);
	
	buildWindow();
}
 
Example 10
Project: incubator-netbeans   File: JobCreator.java   Source Code and License 6 votes vote down vote up
@Messages({
    "JobCreator.copy_message=Global libraries should be copied to a dedicated libraries folder.",
    "JobCreator.copy_label=&Copy Libraries..."
})
public ConfigurationStatus status() {
    if (scm == null) {
        return Helper.noSCMError();
    }
    if (shar != null && !shar.isSharable()) {
        String msg = JobCreator_copy_message();
        JButton button = new JButton();
        Mnemonics.setLocalizedText(button, JobCreator_copy_label());
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                shar.makeSharable();
            }
        });
        return ConfigurationStatus.withWarning(msg).withExtraButton(button);
    }
    ConfigurationStatus scmStatus = scm.problems();
    if (scmStatus != null) {
        return scmStatus;
    } else {
        return ConfigurationStatus.valid();
    }
}
 
Example 11
Project: Progetto-E   File: GUIOperatoreLogin.java   Source Code and License 6 votes vote down vote up
private void initPanel1() {
    
    panel1 = new JPanel();
    panel1.setLayout(new GridLayout(3,1));
    
    JLabel label = new JLabel("Inserire password:");
    JTextField text = new JTextField();
    text.setSize(10, 5);
    JButton bottone = new JButton("Accedi");
    bottone.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String s = text.getText();
            if (s.hashCode()==password) {
                testo.setText("Benvenuto operatore!");
                notifyObservers();
            }
            else {
                testo.setText("Password errata!");
            }
        }
    });
    
    panel1.add(label);
    panel1.add(text);
    panel1.add(bottone);
    
    this.add(panel1);
}
 
Example 12
Project: Equella   File: UserGroupDialog.java   Source Code and License 6 votes vote down vote up
private JPanel createTab(String subject, JTextField field, JButton button, JList list)
{
	JLabel instruction = new JLabel(CurrentLocale.get(
		"com.dytech.edge.admin.helper.usergroupdialog.selectsomething", //$NON-NLS-1$
		subject));

	JScrollPane scrollPane = new JScrollPane(list);

	final int height1 = instruction.getPreferredSize().height;
	final int height2 = button.getPreferredSize().height;
	final int width1 = button.getPreferredSize().width;

	final int[] rows = {height1, height2, TableLayout.FILL};
	final int[] cols = {TableLayout.FILL, width1};

	JPanel all = new JPanel(new TableLayout(rows, cols));
	all.setBorder(AppletGuiUtils.DEFAULT_BORDER);

	all.add(instruction, new Rectangle(0, 0, 2, 1));
	all.add(field, new Rectangle(0, 1, 1, 1));
	all.add(button, new Rectangle(1, 1, 1, 1));
	all.add(scrollPane, new Rectangle(0, 2, 2, 1));

	return all;
}
 
Example 13
Project: scorekeeperfrontend   File: Timer.java   Source Code and License 6 votes vote down vote up
private JComponent controls()
{
	ds = new JButton("Delete Start");
	ds.addActionListener(this);
	ff = new JButton("Fake Finish");
	ff.addActionListener(this);

	df = new JButton("Delete Finish");
	df.addActionListener(this);
	df.setFont(new Font("dialog", Font.BOLD, 13));

	JPanel top = new JPanel();
	top.add(ds);
	top.add(df);
	top.add(ff);

	return top;
}
 
Example 14
Project: incubator-netbeans   File: CreateBranch.java   Source Code and License 6 votes vote down vote up
boolean show() {
    okButton = new JButton(NbBundle.getMessage(CreateBranch.class, "LBL_CreateBranch.OKButton.text")); //NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
    dd = new DialogDescriptor(panel, NbBundle.getMessage(CreateBranch.class, "LBL_CreateBranch.title"), true,  //NOI18N
            new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.git.ui.branch.CreateBranch"), null); //NOI18N
    validate();
    revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange (PropertyChangeEvent evt) {
            if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
                setRevisionValid(Boolean.TRUE.equals(evt.getNewValue()));
            }
        }
    });
    panel.branchNameField.getDocument().addDocumentListener(this);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    return okButton == dd.getValue();
}
 
Example 15
Project: openjdk-jdk10   File: XDataViewer.java   Source Code and License 6 votes vote down vote up
public static void registerForMouseEvent(Component comp,
                                         MouseListener mouseListener) {
    if(comp instanceof JScrollPane) {
        JScrollPane pane = (JScrollPane) comp;
        comp = pane.getViewport().getView();
    }
    if(comp instanceof Container) {
        Container container = (Container) comp;
        Component[] components = container.getComponents();
        for(int i = 0; i < components.length; i++) {
            registerForMouseEvent(components[i], mouseListener);
        }
    }

    //No registration for XOpenTypedata that are themselves clickable.
    //No registration for JButton that are themselves clickable.
    if(comp != null &&
       (!(comp instanceof XOpenTypeViewer.XOpenTypeData) &&
        !(comp instanceof JButton)) )
        comp.addMouseListener(mouseListener);
}
 
Example 16
Project: QN-ACTR-Release   File: EpochPanel.java   Source Code and License 6 votes vote down vote up
private void initComponents() {
	this.setLayout(new BorderLayout());
	epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1));
	JPanel epochOption = new JPanel(new BorderLayout());
	JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT));
	epochs.setPreferredSize(new Dimension(70, 40));
	epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4));
	flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> "));
	flowTemp.add(epochs);
	JButton setEpoch = new JButton(this.setEpoch);
	setEpoch.setPreferredSize(new Dimension(85, 35));
	flowTemp.add(setEpoch);
	epochOption.add(flowTemp, BorderLayout.CENTER);
	//JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	//btnPanel.add(setEpoch);
	//epochOption.add(btnPanel,BorderLayout.SOUTH);
	this.add(epochOption, BorderLayout.NORTH);
}
 
Example 17
Project: incubator-netbeans   File: OperationWizardModel.java   Source Code and License 6 votes vote down vote up
public void modifyOptionsForDoClose (final WizardDescriptor wd, final boolean canCancel) {
    recognizeButtons (wd);
    final JButton b = getOriginalFinish (wd);
    Mnemonics.setLocalizedText (b, getBundle ("InstallUnitWizardModel_Buttons_Close"));
    SwingUtilities.invokeLater (new Runnable () {
        int cnt;
        @Override
        public void run () {
            b.requestFocus();
            if (cnt++ > 0) {
                return;
            }
            
            b.setDefaultCapable(true);
            final JButton[] arr = canCancel ? new JButton [] { b, getOriginalCancel (wd) } : new JButton [] { b };
            wd.setOptions (arr);
            wd.setClosingOptions(arr);
            SwingUtilities.invokeLater(this);
        }
    });
}
 
Example 18
Project: Equella   File: MultiTargetChooser.java   Source Code and License 6 votes vote down vote up
private void createGUI()
{
	add = new JButton(CurrentLocale.get("com.tle.admin.add")); //$NON-NLS-1$
	remove = new JButton(CurrentLocale.get("com.tle.admin.remove")); //$NON-NLS-1$

	add.addActionListener(this);
	remove.addActionListener(this);

	listModel = new GenericListModel<String>();
	list = new JList(listModel);
	JScrollPane scroller = new JScrollPane(list);

	final int height = remove.getPreferredSize().height;
	final int width = remove.getPreferredSize().width;
	final int[] rows = {height, height,};
	final int[] columns = {width, TableLayout.FILL,};

	setLayout(new TableLayout(rows, columns, 5, 5));

	add(add, new Rectangle(0, 0, 1, 1));
	add(remove, new Rectangle(0, 1, 1, 1));
	add(scroller, new Rectangle(1, 0, 1, 2));
}
 
Example 19
Project: incubator-netbeans   File: ActionsTest.java   Source Code and License 6 votes vote down vote up
public void testCheckPrioritiesOfIcons() {
    AbstractAction aa = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    };
    Icon icon = ImageUtilities.loadImageIcon("org/openide/awt/TestIcon_big.png", true);
    aa.putValue(Action.SMALL_ICON, icon);
    aa.putValue("iconBase", "org/openide/awt/data/testIcon.gif");
    
    JButton b = new JButton();
    Actions.connect(b, aa);
    
    JMenuItem m = new JMenuItem();
    Actions.connect(m, aa, false);
    
    
    assertSame("Using the same icon (small" + icon, b.getIcon(), m.getIcon());
}
 
Example 20
Project: rapidminer   File: PendingPurchasesInstallationDialog.java   Source Code and License 6 votes vote down vote up
private JButton remindLaterButton() {
    ResourceAction Action = new ResourceAction("ask_later", new Object[0]) {
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
            PendingPurchasesInstallationDialog.this.wasConfirmed = false;
            PendingPurchasesInstallationDialog.this.checkNeverAskAgain();
            PendingPurchasesInstallationDialog.this.close();
        }
    };
    this.getRootPane().getInputMap(2).put(KeyStroke.getKeyStroke(27, 0, false), "CLOSE");
    this.getRootPane().getActionMap().put("CLOSE", Action);
    JButton button = new JButton(Action);
    this.getRootPane().setDefaultButton(button);
    return button;
}
 
Example 21
Project: incubator-netbeans   File: NodeSelectionProjectPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Creates new form ActualSelectionProjectPanel
 */
public NodeSelectionProjectPanel() {
    super(new BorderLayout());
    JButton closeButton = CloseButtonFactory.createBigCloseButton();
    prefs.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, this, prefs));
    closeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            prefs.putBoolean(KEY_ACTUALSELECTIONPROJECT, false);
        }
    });
    add(closeButton, BorderLayout.EAST);

    setBorder(new SeparatorBorder());
    preferenceChange(null);
}
 
Example 22
Project: Dahlem_SER316   File: CharTablePanel.java   Source Code and License 6 votes vote down vote up
void createButtons() {
    for (int i = 0; i < chars.length; i++) {
        JButton button = new JButton(new CharAction(chars[i]));
        button.setMaximumSize(new Dimension(50, 22));
        //button.setMinimumSize(new Dimension(22, 22));
        button.setPreferredSize(new Dimension(30, 22));
        button.setRequestFocusEnabled(false);
        button.setFocusable(false);
        button.setBorderPainted(false);
        button.setOpaque(false);
        button.setMargin(new Insets(0,0,0,0));
        button.setFont(new Font("serif", 0, 14));
        if (i == chars.length-1) {
            button.setText("nbsp");
            button.setFont(new Font("Dialog",0,10));
            button.setMargin(new Insets(0,0,0,0));
        }
        this.add(button, null);
    }
}
 
Example 23
Project: openjdk-jdk10   File: bug6219960.java   Source Code and License 6 votes vote down vote up
private static JButton findButton(Component comp) {

        if (comp instanceof JButton) {
            return (JButton) comp;
        }

        if (comp instanceof Container) {
            Container cont = (Container) comp;
            for (int i = 0; i < cont.getComponentCount(); i++) {
                JButton result = findButton(cont.getComponent(i));
                if (result != null) {
                    return result;
                }
            }
        }
        return null;
    }
 
Example 24
Project: incubator-netbeans   File: IDEServicesImpl.java   Source Code and License 6 votes vote down vote up
private File selectPatchContext() {
    PatchContextChooser chooser = new PatchContextChooser();
    ResourceBundle bundle = NbBundle.getBundle(IDEServicesImpl.class);
    JButton ok = new JButton(bundle.getString("LBL_Apply")); // NOI18N
    JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N
    DialogDescriptor descriptor = new DialogDescriptor(
            chooser,
            bundle.getString("LBL_ApplyPatch"), // NOI18N
            true,
            NotifyDescriptor.OK_CANCEL_OPTION,
            ok,
            null);
    descriptor.setOptions(new Object [] {ok, cancel});
    descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.bugtracking.patchContextChooser")); // NOI18N
    File context = null;
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (descriptor.getValue() == ok) {
        context = chooser.getSelectedFile();
    }
    return context;
}
 
Example 25
Project: Community_Tieba-Data-Analyzer   File: WebCrawler.java   Source Code and License 6 votes vote down vote up
public void paintCrawler(JPanel _panel) {
		//Define all new Components GUI
		JPanel crawlerPanel = new JPanel();
		JPanel configPanel = new JPanel();
		JButton crawl = new JButton(" Crawl ");
		JTextField name = new JTextField(25);
		name.setText("userNameID");
		JButton random = new JButton("Random");
				
		//Add action Listener
		crawl.addActionListener(event -> crawlInfo(name.getText()));
//		random.addActionListener();
		        
		//add to pane and manage layout
		_panel.add(configPanel, BorderLayout.CENTER);
		_panel.add(crawlerPanel, BorderLayout.SOUTH);
		crawlerPanel.add(crawl);
		configPanel.add(name);
		crawlerPanel.add(random);
	}
 
Example 26
Project: AgentWorkbench   File: DynFormBase.java   Source Code and License 6 votes vote down vote up
/**
 * Reset sub object.
 * @param node the node
 */
private void resetValuesOnSubForm(DefaultMutableTreeNode node) {
	
	// --- Set the value to null ----------------------
	DynType dynType = (DynType) node.getUserObject(); 
	this.setSingleValue(dynType, null);
	
	// --- Is there a multiple button to remove? ------
	JButton multipleButton = dynType.getJButtonMultipleOnDynFormPanel();
	if (multipleButton!=null) {
		if (multipleButton.getText().equals("+")==false) {
			multipleButton.doClick();
		}
	}

	// --- Are there any sub nodes available? ---------
	if (node.getChildCount()>0) {
		for (int i=0; i < node.getChildCount(); i++) {
			DefaultMutableTreeNode subNode = (DefaultMutableTreeNode) node.getChildAt(i);
			this.resetValuesOnSubForm(subNode);
		}
	}
	
}
 
Example 27
Project: Tarski   File: TypeWizard.java   Source Code and License 6 votes vote down vote up
/**
 * Create the frame.
 */
public TypeWizard(final Graph graph, final Object onWhat, final List<Object> list) {
  this.graph = graph;
  this.onWhat = onWhat;

  this.setTitle("Change Atom Type Wizard");
  this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  this.setBounds(100, 100, 450, 300);
  this.getContentPane().setLayout(new BorderLayout(0, 0));

  final JScrollPane scrollPane = new JScrollPane();
  this.getContentPane().add(scrollPane, BorderLayout.CENTER);

  this.list = new JList<Object>();
  this.list.setFont(new Font("Times New Roman", Font.PLAIN, 12));
  this.list.setBorder(new LineBorder(new Color(0, 0, 0)));
  this.list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  this.list.setModel(new TypeListModel(list));
  scrollPane.setViewportView(this.list);

  final JPanel buttonPanel = new JPanel();
  this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
  buttonPanel.setLayout(new BorderLayout(0, 0));

  this.finishButton = new JButton("Finish");
  this.finishButton.setFont(new Font("Times New Roman", Font.PLAIN, 12));
  this.finishButton.setMnemonic('F');
  buttonPanel.add(this.finishButton, BorderLayout.EAST);

  this.finishButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(final ActionEvent arg) {
      TypeWizard.this.performFinish();
      GraphUtil.getInstance().layout();
      TypeWizard.this.dispose();
    }
  });
}
 
Example 28
Project: VASSAL-src   File: BoardPicker.java   Source Code and License 6 votes vote down vote up
protected void initComponents() {
  multipleButtons = new ArrayList<JButton>();
  controls = new JPanel(new BorderLayout());
  statusLabel = new JLabel(""); //$NON-NLS-1$
  statusLabel.setForeground(Color.BLUE);
  slotPanel = new JPanel();
  toolbar = new JToolBar();
  toolbar.setFloatable(false);
  toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.Y_AXIS));
  addRowButton = addButton(addRowButtonText);
  multipleButtons.add(addRowButton);
  addColumnButton = addButton(addColumnButtonText);
  multipleButtons.add(addColumnButton);
  clearButton = addButton(Resources.getString("BoardPicker.clear")); //$NON-NLS-1$
  multipleButtons.add(clearButton);
  setAllowMultiple(allowMultiple);
  controls.add(BorderLayout.NORTH, statusLabel);
  JPanel pp = new JPanel();
  pp.add(toolbar);
  controls.add(BorderLayout.WEST, pp);
  slotScroll = new JScrollPane(slotPanel);
  controls.add(BorderLayout.CENTER, slotScroll);
  reset();
}
 
Example 29
Project: incubator-netbeans   File: BrokenReferencesImpl.java   Source Code and License 5 votes vote down vote up
@NbBundle.Messages({
    "LBL_BrokenLinksCustomizer_Close=Close",
    "ACSD_BrokenLinksCustomizer_Close=N/A",
    "LBL_BrokenLinksCustomizer_Title=Resolve Project Problems - \"{0}\" Project"
})
@Override
public void showCustomizer(@NonNull Project project) {
    Parameters.notNull("project", project); //NOI18N
    BrokenReferencesModel model = new BrokenReferencesModel(project);
    BrokenReferencesCustomizer customizer = new BrokenReferencesCustomizer(model);
    JButton close = new JButton (LBL_BrokenLinksCustomizer_Close()); // NOI18N
    close.getAccessibleContext ().setAccessibleDescription (ACSD_BrokenLinksCustomizer_Close()); // NOI18N
    String projectDisplayName = ProjectUtils.getInformation(project).getDisplayName();
    DialogDescriptor dd = new DialogDescriptor(customizer,
        LBL_BrokenLinksCustomizer_Title(projectDisplayName), // NOI18N
        true, new Object[] {close}, close, DialogDescriptor.DEFAULT_ALIGN, null, null);
    customizer.setNotificationLineSupport(dd.createNotificationLineSupport());
    Dialog dlg = null;
    try {
        dlg = DialogDisplayer.getDefault().createDialog(dd);
        dlg.setVisible(true);
    } finally {
        if (dlg != null) {
            dlg.dispose();
        }
    }
}
 
Example 30
Project: geomapapp   File: StartUp.java   Source Code and License 5 votes vote down vote up
public StartUp( int which ) {
	try {
		URL url = null;
		switch (which) {
			case MapApp.MERCATOR_MAP:
				url = cl.getResource(startUpPath +"smallmapV3.jpg"); //New version3 images
				break;
			case MapApp.SOUTH_POLAR_MAP:
				url = cl.getResource(startUpPath + "MapAppSouthV3.jpg");
				break;
			case MapApp.NORTH_POLAR_MAP:
				url = cl.getResource(startUpPath + "MapAppNorthV3.jpg");
				break;
			case MapApp.WORLDWIND:
				url = cl.getResource(startUpPath + "VirtualOceanV3.jpg");
				break;
			default:
				url = cl.getResource(startUpPath + "smallmap.jpg");
		}
		image = ImageIO.read(url);
	} catch (Exception ex) {
		System.out.println(ex + " null");
		image=null;
	}
	setLayout(null);
	label = new JLabel("Initializing MapApp...");
	label.setFont( new Font("SansSerif", Font.PLAIN, 12) );
	label.setForeground( Color.black );
//	add( label );
	label.setLocation(10, 50);
	label.setSize( label.getPreferredSize() );
	JButton button = new JButton( "Abort" );
	add( button );
	button.setLocation( 3, 3);
	button.setSize( button.getPreferredSize() );
	button.addActionListener( this );
//	System.out.println( getComponentCount() + " components" );
	setBorder( BorderFactory.createLineBorder(Color.black, 2) );
}
 
Example 31
Project: oxygen-git-plugin   File: CommitPanel.java   Source Code and License 5 votes vote down vote up
private void addCommitButton(GridBagConstraints gbc) {
	gbc.insets = new Insets(UIConstants.COMPONENT_TOP_PADDING, UIConstants.COMPONENT_LEFT_PADDING,
			UIConstants.COMPONENT_BOTTOM_PADDING, UIConstants.COMPONENT_RIGHT_PADDING);
	gbc.anchor = GridBagConstraints.EAST;
	gbc.fill = GridBagConstraints.NONE;
	gbc.gridx = 1;
	gbc.gridy = 3;
	gbc.weightx = 1;
	gbc.weighty = 0;
	commitButton = new JButton(translator.getTranslation(Tags.COMMIT_BUTTON_TEXT));
	toggleCommitButton(false);
	this.add(commitButton, gbc);
}
 
Example 32
Project: incubator-netbeans   File: BrowseFolders.java   Source Code and License 5 votes vote down vote up
public static FileObject showDialog(SourceGroup[] folders) {

        BrowseFolders bf = new BrowseFolders(folders);

        JButton options[] = new JButton[]{
            new JButton(NbBundle.getMessage(BrowseFolders.class, "LBL_SelectFile")),
            new JButton(NbBundle.getMessage(BrowseFolders.class, "LBL_Cancel"))
        };

        OptionsListener optionsListener = new OptionsListener(bf);

        options[ 0].setActionCommand(OptionsListener.COMMAND_SELECT);
        options[ 0].addActionListener(optionsListener);
        options[ 0].getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_SelectFile"));
        options[ 1].setActionCommand(OptionsListener.COMMAND_CANCEL);
        options[ 1].addActionListener(optionsListener);
        options[ 1].getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(BrowseFolders.class, "ACSD_Cancel"));

        DialogDescriptor dialogDescriptor = new DialogDescriptor(
                bf, // innerPane
                NbBundle.getMessage(BrowseFolders.class, "LBL_BrowseFiles"), // displayName
                true, // modal
                options, // options
                options[ 0], // initial value
                DialogDescriptor.BOTTOM_ALIGN, // options align
                null, // helpCtx
                null);                                 // listener 

        dialogDescriptor.setClosingOptions(new Object[]{options[ 0], options[ 1]});

        Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
        dialog.setVisible(true);

        return optionsListener.getResult();

    }
 
Example 33
Project: incubator-netbeans   File: HintsPanelLogic.java   Source Code and License 5 votes vote down vote up
void connect( final JTree errorTree, DefaultTreeModel errorTreeModel, JLabel severityLabel, JComboBox severityComboBox,
              JCheckBox tasklistCheckBox, JPanel customizerPanel,
              JEditorPane descriptionTextArea, final JComboBox configCombo, JButton editScript,
              HintsSettings settings, boolean direct) {
    
    this.errorTree = errorTree;
    this.errorTreeModel = errorTreeModel;
    this.severityLabel = severityLabel;
    this.severityComboBox = severityComboBox;
    this.tasklistCheckBox = tasklistCheckBox;
    this.customizerPanel = customizerPanel;
    this.descriptionTextArea = descriptionTextArea;        
    this.configCombo = configCombo;
    this.editScript = editScript;
    this.direct = direct;
    
    if (configCombo.getSelectedItem() !=null) {
        originalSettings = ((Configuration) configCombo.getSelectedItem()).getSettings();
    } else if (settings != null) {
        originalSettings = settings;
    } else {
        originalSettings = HintsSettings.getGlobalSettings();
    }
    
    writableSettings = new WritableSettings(originalSettings, direct);
    
    valueChanged( null );
    
    errorTree.addKeyListener(this);
    errorTree.addMouseListener(this);
    errorTree.getSelectionModel().addTreeSelectionListener(this);
        
    this.configCombo.addItemListener(this);
    severityComboBox.addActionListener(this);
    tasklistCheckBox.addChangeListener(this);
    
}
 
Example 34
Project: rapidminer   File: FancyDropDownButton.java   Source Code and License 5 votes vote down vote up
public JButton addToToolbar(JPanel toolbar, Object mainButtonConstraints, Object arrowButtonConstraints) {
	arrowButtonPanel.add(arrowButton);
	arrowButtonPanel.add(emptyPanel);
	toolbar.add(mainButton, mainButtonConstraints);
	toolbar.add(arrowButtonPanel, arrowButtonConstraints);
	return mainButton;
}
 
Example 35
Project: incubator-netbeans   File: SourceRootsUi.java   Source Code and License 5 votes vote down vote up
public static EditMediator registerEditMediator( Project master,
                                         SourceRoots sourceRoots,
                                         JTable rootsList,
                                         JButton addFolderButton,
                                         JButton removeButton,
                                         JButton upButton,
                                         JButton downButton ) {
    return registerEditMediator(master, sourceRoots, rootsList, addFolderButton, 
            removeButton, upButton, downButton, null, true);
}
 
Example 36
Project: MTG-Card-Recognizer   File: PopoutCardWindow.java   Source Code and License 5 votes vote down vote up
public PopoutCardWindow()
{
	super("Card Popout");
	this.setLayout(new BorderLayout());
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	if(!init)
	{
		clear();
		init = true;
	}
	JButton button = new JButton(new AbstractAction("Clear") {
		private static final long serialVersionUID = 1L;

		public void actionPerformed(ActionEvent e) {
			clear();
		}
	});
	this.add(display, BorderLayout.CENTER);
	this.add(button, BorderLayout.SOUTH);
	pack();
	getContentPane().setBackground(Color.WHITE);
	setResizable(false);
	setVisible(true);
	img=null;
	card=null;
	timer = new Timer(40,this);
	timer.start();
}
 
Example 37
Project: propan-jogl-examples   File: Example.java   Source Code and License 5 votes vote down vote up
public static JComponent createComponent() {
	JPanel panel = new JPanel(new BorderLayout());
	panel.setDoubleBuffered(false);

	panel.add(new JButton("Press me!"), BorderLayout.NORTH);

	JProgressBar bar = new JProgressBar() {
		protected void paintComponent(java.awt.Graphics g) {
			if (g instanceof GLGraphics2D
					) {
				super.paintComponent(g);
			} else {
				System.out.println(g.getClass());
			}
		}
	};
	bar.setIndeterminate(true);
	panel.add(bar, BorderLayout.SOUTH);
	panel.add(new JSlider(SwingConstants.VERTICAL, 0, 10, 3), BorderLayout.EAST);

	ButtonGroup grp = new ButtonGroup();
	JRadioButton radio1 = new JRadioButton("FM");
	JRadioButton radio2 = new JRadioButton("AM");
	grp.add(radio1);
	grp.add(radio2);

	JPanel panel2 = new JPanel(new GridLayout(0, 1));
	panel2.add(radio1);
	panel2.add(radio2);

	JComboBox b = new JComboBox(new String[] {"3", "4"});

	panel.add(b, BorderLayout.WEST);

	panel.setBorder(BorderFactory.createTitledBorder("Border"));

	return panel;
}
 
Example 38
Project: java-irc   File: Channel.java   Source Code and License 5 votes vote down vote up
/**
 * Create the frame to choose the channel
 */
public Channel() {
	this.setTitle("Chat IRC");
	this.setResizable(false);
	this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	this.setBounds(100, 100, 460, 261);
	this.setLocationRelativeTo(null);
	setIconImage(Toolkit.getDefaultToolkit().getImage(Channel.class.getResource("/image/swag.png")));
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JButton btnOk = new JButton("OK");
	Icon imgOk = new ImageIcon(Toolkit.getDefaultToolkit().getImage(Channel.class.getResource("/image/ok.png")));
	btnOk.setIcon(imgOk);
	btnOk.setFont(new Font("Tahoma", Font.BOLD, 14));
	btnOk.addActionListener(new ChannelListener());
	btnOk.setBounds(164, 152, 104, 30);
	contentPane.add(btnOk);
	
	JLabel lblChannel = new JLabel("Channel");
	lblChannel.setHorizontalAlignment(SwingConstants.LEFT);
	lblChannel.setFont(new Font("Tahoma", Font.BOLD, 14));
	lblChannel.setBounds(187, 30, 72, 30);
	contentPane.add(lblChannel);
	
	textFieldChannel = new JTextField();
	textFieldChannel.setFont(new Font("Tahoma", Font.PLAIN, 14));
	textFieldChannel.setBounds(115, 85, 203, 30);
	contentPane.add(textFieldChannel);
	textFieldChannel.setColumns(10);
	
	this.addWindowListener( new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			closeFrame();
		}
	});
}
 
Example 39
Project: geomapapp   File: LayerManager.java   Source Code and License 5 votes vote down vote up
private JButton createButton(int icon) {
	JButton button = new JButton( Icons.getIcon(icon,false));
	button.setPressedIcon( Icons.getIcon(icon, true) );
	button.setDisabledIcon( Icons.getDisabledIcon( icon, false ));
	button.setBorder( BorderFactory.createLineBorder(Color.black));
	button.setMargin(new Insets(1,0,1,0));
	return button;
}
 
Example 40
Project: incubator-netbeans   File: ActionMappings.java   Source Code and License 5 votes vote down vote up
public static void showAddPropertyPopupMenu(JButton btn, JTextComponent area, JTextField goalsField, @NullAllowed NbMavenProjectImpl project) {
    JPopupMenu menu = new JPopupMenu();
    menu.add(new SkipTestsAction(area));
    menu.add(new DebugMavenAction(area));
    menu.add(new EnvVarAction(area));
    menu.add(createJdkSubmenu(area));
    menu.add(createGlobalVarSubmenu(area));
    if (project != null) {
        menu.add(new PluginPropertyAction(area, goalsField, project));
    }
    menu.add(createFileSelectionSubmenu(area));
    menu.show(btn, btn.getSize().width, 0);
}
 
Example 41
Project: incubator-netbeans   File: SaveBeforeCommitConfirmation.java   Source Code and License 5 votes vote down vote up
private boolean confirmContinueCommit(Collection<String> errMsgs) {
    if ((errMsgs == null) || errMsgs.isEmpty()) {
        return true;
    }

    JButton btnShowMoreInfo = new JButton();
    JComponent info = new ExpandableMessage(
            "MSG_ExceptionWhileSavingMoreFiles_Intro",              //NOI18N
            errMsgs,
            "MSG_ExceptionWhileSavingMoreFiles_Question",           //NOI18N
            btnShowMoreInfo);
    String commitLbl = getMessage("LBL_ProceedWithCommit");         //NOI18N

    DialogDescriptor errDialog = new DialogDescriptor(
                    info,
                    getMessage("MSG_Title_SavingError"),   //title  //NOI18N
                    true,                                  //modal
                    OK_CANCEL_OPTION,
                    WARNING_MESSAGE,
                    null);                                 //button listener
    errDialog.setOptions(new Object[] {commitLbl, CANCEL_OPTION});
    errDialog.setAdditionalOptions(new Object[] {btnShowMoreInfo});
    errDialog.setValue(CANCEL_OPTION);             //default option
    errDialog.setClosingOptions(new Object[] {commitLbl, CANCEL_OPTION});
    Object value = DialogDisplayer.getDefault().notify(errDialog);
    return (value == commitLbl);
}
 
Example 42
Project: QN-ACTR-Release   File: LDEditingWindow.java   Source Code and License 5 votes vote down vote up
/**
 * @return the button bar
 */
JPanel makeButtons() {
	JPanel res = new JPanel();
	JButton commit = new JButton(LD_COMMIT);
	help.addHelp(commit, "Closes the LD editor saving changes");
	res.add(commit);
	JButton cancel = new JButton(LD_CANCEL);
	help.addHelp(cancel, "Closes the LD editor discarding all changes");
	res.add(cancel);
	JButton help_b = new JButton(LD_HELP);
	help.addHelp(help_b, "Shows help for the LD editor");
	res.add(help_b);
	return res;
}
 
Example 43
Project: VASSAL-src   File: ToolbarMenu.java   Source Code and License 5 votes vote down vote up
public void propertyChange(PropertyChangeEvent evt) {
  JButton b = (JButton) evt.getSource();
  JMenuItem mi = buttonsToMenuMap.get(b);
  if (mi != null) {
    if (AbstractButton.TEXT_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
      scheduleBuildMenu();
    }
    else if ("enabled".equals(evt.getPropertyName())) { //$NON-NLS-1$
      mi.setEnabled(b.isEnabled());
    }
    else if (AbstractButton.ICON_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
      mi.setIcon(b.getIcon());
    }
  }
}
 
Example 44
Project: jtk   File: LogAxisPlotDemo.java   Source Code and License 5 votes vote down vote up
public static JButton limitsTestButton(final PlotPanel plot){
  JButton b = new JButton("setLimits Test");
  b.addActionListener(new ActionListener() {
    
    @Override
    public void actionPerformed(ActionEvent arg0) {
      plot.setLimits(10,20,100,1000);
    }
  });
  return b;
}
 
Example 45
Project: FreeCol   File: ChooseFoundingFatherDialog.java   Source Code and License 5 votes vote down vote up
/**
 * The constructor that will add the items to this panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param possibleFoundingFathers The {@code FoundingFather}s
 *     which can be selected. The length of the array is the same
 *     as the number of {@code FoundingFather} categories and the
 *     values identifies a {@code FoundingFather} to be picked in
 *     each of those categories.
 */
public ChooseFoundingFatherDialog(FreeColClient freeColClient, JFrame frame,
        List<FoundingFather> possibleFoundingFathers) {
    super(freeColClient, frame);

    this.possibleFathers = possibleFoundingFathers;
    this.tb = new JTabbedPane(JTabbedPane.TOP);

    JButton helpButton = new JButton(freeColClient.getActionManager()
        .getFreeColAction("colopediaAction.fathers"));
    helpButton.setText(Messages.message("help"));

    FatherDetailPanel details = new FatherDetailPanel(freeColClient,
        new ColopediaPanel(freeColClient));
    for (FoundingFather father : possibleFoundingFathers) {
        JPanel jp = new MigPanel();
        details.buildDetail(father, jp);
        jp.validate();
        tb.addTab(Messages.message(father.getTypeKey()), jp);
    }
    tb.setSelectedIndex(0);

    MigPanel panel = new MigPanel(new MigLayout("wrap 1", "align center"));
    panel.add(Utility.localizedHeader("chooseFoundingFatherDialog.title", false));
    panel.add(helpButton, "tag help");
    panel.add(tb, "width 100%");
    panel.setPreferredSize(panel.getPreferredSize());

    List<ChoiceItem<FoundingFather>> c = choices();
    c.add(new ChoiceItem<>(Messages.message("ok"), (FoundingFather)null)
        .okOption().defaultOption());
    initializeDialog(frame, DialogType.QUESTION, false, panel, null, c);
}
 
Example 46
Project: openjdk-jdk10   File: JFormattedTextFieldTest.java   Source Code and License 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent evt) {
    if (evt.getSource() instanceof JButton) {
        JButton btn = (JButton) evt.getSource();
        cleanUp();
        switch (btn.getActionCommand()) {
            case "Pass":
                break;
            case "Fail":
                throw new AssertionError("User Clicked Fail!");
        }
    }
}
 
Example 47
Project: freecol   File: FreeColOptionPaneUI.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void selectInitialValue(JOptionPane op) {
    if (initialFocusComponent != null) {
        initialFocusComponent.requestFocus();
 
        if (initialFocusComponent instanceof JButton) {
            JRootPane root = SwingUtilities.getRootPane(initialFocusComponent);
            if (root != null) {
                root.setDefaultButton((JButton)initialFocusComponent);
            }
        }
    }
}
 
Example 48
Project: Equella   File: SchemaList.java   Source Code and License 5 votes vote down vote up
private void setupGui()
{
	JLabel instruction = new JLabel(CurrentLocale.get("com.tle.admin.itemdefinition.mapping.schemalist.choose")); //$NON-NLS-1$

	alreadyChosen = new JLabel(CurrentLocale.get("com.tle.admin.itemdefinition.mapping.schemalist.selected")); //$NON-NLS-1$
	alreadyChosen.setForeground(Color.RED);

	chooser = new SingleTargetChooser(schema, null);
	chooser.addTargetListener(this);

	ok = new JButton(CurrentLocale.get("com.tle.admin.ok")); //$NON-NLS-1$
	cancel = new JButton(CurrentLocale.get("com.tle.admin.cancel")); //$NON-NLS-1$

	ok.addActionListener(this);
	cancel.addActionListener(this);

	final int height1 = instruction.getPreferredSize().height;
	final int height2 = chooser.getPreferredSize().height;
	final int height3 = cancel.getPreferredSize().height;
	final int width1 = cancel.getPreferredSize().width;

	final int[] rows = {height1, height2, height1, height3,};
	final int[] cols = {TableLayout.FILL, width1, width1,};

	content = new JPanel(new TableLayout(rows, cols));
	content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	content.add(instruction, new Rectangle(0, 0, 3, 1));
	content.add(chooser, new Rectangle(0, 1, 3, 1));
	content.add(alreadyChosen, new Rectangle(0, 2, 3, 1));
	content.add(ok, new Rectangle(1, 3, 1, 1));
	content.add(cancel, new Rectangle(2, 3, 1, 1));

	updateGui(chooser.getTarget());
}
 
Example 49
Project: incubator-netbeans   File: NotifyExcPanelTest.java   Source Code and License 5 votes vote down vote up
public void testHandlesThatImplementCallableForJButtonAreIncluded() throws Exception {
    class H extends Handler 
    implements Callable<JButton> {
        public JButton button = new JButton("Extra");
    
        public void publish(LogRecord arg0) {
        }

        public void flush() {
        }

        public void close() throws SecurityException {
        }

        public JButton call() throws Exception {
            return button;
        }
    } // end of H
    
    H handler = new H();
    
    main.addHandler(handler);
    
    List<Object> options = Arrays.asList(NotifyExcPanel.computeOptions("prev", "next"));
    
    assertTrue("Contains our button: " + options, options.contains(handler.button));
}
 
Example 50
Project: Cognizant-Intelligent-Test-Scripter   File: TestCaseComponent.java   Source Code and License 5 votes vote down vote up
private void init() {
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    JButton drag = new JButton("   ");
    toolBar.add(drag);
    registerDrag(drag);
    toolBar.add(create("Show Console", "cmd"));
    toolBar.add(create("Continue Execution", "continue"));
    toolBar.add(create("Go to Next Step", "next"));
    toolBar.add(create("Pause the Execution", "pause"));
    toolBar.add(create("Stop the Execution", "stop"));
    add(toolBar);
}
 
Example 51
Project: cuttlefish   File: StatusBar.java   Source Code and License 5 votes vote down vote up
public StatusBar() {
	super();
	this.setBackground(Color.WHITE);
	terminateTask = new JButton("Stop");
	label = new JLabel();
	label1 = new JLabel("Status ");
	progressBar = new JProgressBar();
	progressBar.setMinimum(50);
	progressBar.setMaximum(100);
	add(label1);
	add(progressBar);
	add(label);
	add(terminateTask);
	setMessage("Ready");

	terminateTask.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {

			if (layoutController == null /* || currentTask == null */)
				return;

			// currentTask.cancel(true);

			if (layoutController.canStop())
				layoutController.stopLayout();

			setMessage("Task canceled");
			terminateTask.setEnabled(false);
		}
	});

}
 
Example 52
Project: owa-notifier   File: TextNotification.java   Source Code and License 5 votes vote down vote up
public TextNotification() {
	m_fromLabel = new JLabel();
	m_titleLabel = new JLabel();
	m_titleLabel.addMouseListener(new NotificationMouseAdapter(m_titleLabel));
	
	m_subtitleArea = new JTextArea();
	m_subtitleArea.addMouseListener(new NotificationMouseAdapter(m_titleLabel));
	
	JPanel panelHeader = new JPanel();
	panelHeader.setLayout(new BoxLayout(panelHeader, BoxLayout.PAGE_AXIS));
	JButton dimissButton = new JButton();
	dimissButton.setText("X");
	final TextNotification me = this;
	dimissButton.addActionListener(new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent arg0) {
			// TODO Auto-generated method stub
			me.removeFromManager();
		}
		
	});
	dimissButton.setOpaque(false);
	dimissButton.setContentAreaFilled(false);
	dimissButton.setBorderPainted(false);
	dimissButton.setBounds((int) (this.getWidth() - dimissButton.getPreferredSize().getWidth()), 0, (int) dimissButton.getPreferredSize().getWidth(), (int) dimissButton.getPreferredSize().getHeight());
	m_panel.add(dimissButton);
	
	
	panelHeader.add(m_fromLabel);
	panelHeader.add(m_titleLabel);
	this.addComponent(panelHeader, BorderLayout.NORTH);
	this.addComponent(m_subtitleArea, BorderLayout.CENTER);
}
 
Example 53
Project: incubator-netbeans   File: PalettePanel.java   Source Code and License 5 votes vote down vote up
private void prepareSearchPanel() {
    if( searchpanel == null ) {
        searchpanel = new SearchPanel();

        JLabel lbl = new JLabel(NbBundle.getMessage(PalettePanel.class, "LBL_QUICKSEARCH")); //NOI18N
        searchpanel.setLayout(new GridBagLayout());
        searchpanel.add(lbl, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(searchTextField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(new JLabel(), new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
        lbl.setLabelFor(searchTextField);
        searchTextField.setColumns(10);
        searchTextField.setMaximumSize(searchTextField.getPreferredSize());
        searchTextField.putClientProperty("JTextField.variant", "search"); //NOI18N
        lbl.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));

        JButton btnCancel = new JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/palette/resources/cancel.png", true));
        btnCancel.setBorder(BorderFactory.createEmptyBorder());
        btnCancel.setBorderPainted(false);
        btnCancel.setOpaque(false);
        btnCancel.setContentAreaFilled(false);
        searchpanel.add(btnCancel, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        btnCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                removeSearchField();
            }
        });
    }
}
 
Example 54
Project: Equella   File: JFlatScrollBar.java   Source Code and License 5 votes vote down vote up
@Override
protected JButton createIncreaseButton(int orientation)
{
	if( orientation == SOUTH )
	{
		// note that increase is along y-axis; ie. down is positive
		return new JFlatArrowButton(JFlatArrowButton.DOWN);
	}
	else
	{
		return new JFlatArrowButton(JFlatArrowButton.RIGHT);
	}
}
 
Example 55
Project: routerapp   File: PropertyInteractionDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Creates an instance of this instance.
 * @param posX the x coordinate of the position where the window will be shown
 * @param posY the y coordinate of the position where the window will be shown
 * @param component the component whose properties are shown by this window
 */
public PropertyInteractionDialog(int posX,int posY, Graph graph, GraphComponent component) {
	this.setBounds(posX,posY,200,200);
	this.setTitle("Property interaction");
	this.setResizable(false);
	this.setModal(true);
	
	fields = new HashMap();
	this.graph = graph;
	this.component = component;
	
	
	okButton = new JButton(OK_ACTION);
	cancelButton = new JButton(CANCEL_ACTION);
	
	// center panel
	JPanel centerPanel = new JPanel(new BorderLayout());
	//JScrollPane tablePanel = new JScrollPane(propertiesTable);
	//centerPanel.add(tablePanel,BorderLayout.CENTER);
	
	// south panel
	JPanel southPanel = new JPanel(new BorderLayout());
	JPanel okCancelPanel = new JPanel(new FlowLayout());
	okCancelPanel.add(okButton);
	okCancelPanel.add(cancelButton);
	southPanel.add(okCancelPanel,BorderLayout.EAST);
	
	// add panels to the dialog window
	getContentPane().setLayout(new BorderLayout());
	//this.getContentPane().add(centerPanel,BorderLayout.CENTER);
	getContentPane().add(southPanel,BorderLayout.SOUTH);
	buildFields();
}
 
Example 56
Project: ohjelmistotuotanto2017   File: Tapahtumankuuntelija.java   Source Code and License 5 votes vote down vote up
public Tapahtumankuuntelija(JButton plus, JButton miinus, JButton nollaa, JButton undo, JTextField tuloskentta, JTextField syotekentta) {
    this.plus = plus;
    this.miinus = miinus;
    this.nollaa = nollaa;
    this.undo = undo;
    this.tuloskentta = tuloskentta;
    this.syotekentta = syotekentta;
    this.sovellus = new Sovelluslogiikka();
}
 
Example 57
Project: A-Pathfinding-Visualization   File: ControlHandler.java   Source Code and License 5 votes vote down vote up
public JButton getB(String t) {
	for(int i = 0; i < buttons.size(); i++) {
		if(buttons.get(i).getName().equals(t)) {
			return buttons.get(i);
		}
	}
	return null;
}
 
Example 58
Project: incubator-netbeans   File: CloseButtonFactory.java   Source Code and License 5 votes vote down vote up
/**
 * Creates a big 'close' JButton with close icon, rollover icon and pressed icon according to Look and Feel
 *
 * @return JButton with close icons.
 */
public static JButton createBigCloseButton() {
    JButton closeButton = new JButton();
    int size = 19;
    closeButton.setPreferredSize(new Dimension(size, size));
    closeButton.setContentAreaFilled(false);
    closeButton.setFocusable(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setBorderPainted(false);
    closeButton.setRolloverEnabled(true);
    closeButton.setIcon(getBigCloseTabImage());
    closeButton.setRolloverIcon(getBigCloseTabRolloverImage());
    closeButton.setPressedIcon(getBigCloseTabPressedImage());
    return closeButton;
}
 
Example 59
Project: OpenJSharp   File: SwingApplet.java   Source Code and License 5 votes vote down vote up
private void initUI() {
    // Trying to set Nimbus look and feel
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
    } catch (Exception ex) {
        Logger.getLogger(SwingApplet.class.getName()).
                log(Level.SEVERE, "Failed to apply Nimbus look and feel", ex);
    }
    getContentPane().setLayout(new FlowLayout());
    button = new JButton("Hello, I'm a Swing Button!");
    getContentPane().add(button);
    getContentPane().doLayout();
}
 
Example 60
Project: LogisticApp   File: FracionalPanelBuilder.java   Source Code and License 5 votes vote down vote up
private void initializeButtons() {
	this.btnBuscar = new JButton("Buscar");
	this.btnBuscar.addActionListener(this);
	GridBagConstraints gbc_btnBuscar = new GridBagConstraints();
	gbc_btnBuscar.insets = new Insets(0, 0, 5, 5);
	gbc_btnBuscar.gridx = 5;
	gbc_btnBuscar.gridy = 0;
	this.panelSecond.add(btnBuscar, gbc_btnBuscar);
}