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: Progetto-A File: PartitaOfflineGuiView.java View source code | 6 votes |
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 2
Project: incubator-netbeans File: Reset.java View source code | 6 votes |
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 3
Project: incubator-netbeans File: RunTargetsAction.java View source code | 6 votes |
@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 4
Project: HBaseClient File: SubmitActionListener.java View source code | 6 votes |
public void keyReleased(KeyEvent e) { if ( e.getKeyChar() == '\n' ) { ((JButton)e.getSource()).doClick(); } }
Example 5
Project: VASSAL-src File: ServerAddressBook.java View source code | 6 votes |
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 6
Project: SE2Project File: RueckgabeUI.java View source code | 6 votes |
/** * 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 7
Project: incubator-netbeans File: InstallerTest.java View source code | 6 votes |
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 8
Project: incubator-netbeans File: TerminalSupportImpl.java View source code | 6 votes |
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 9
Project: JITRAX File: NewDatabaseDialog.java View source code | 6 votes |
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 View source code | 6 votes |
@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: Equella File: UserGroupDialog.java View source code | 6 votes |
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 12
Project: scorekeeperfrontend File: Timer.java View source code | 6 votes |
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 13
Project: incubator-netbeans File: CreateBranch.java View source code | 6 votes |
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 14
Project: openjdk-jdk10 File: XDataViewer.java View source code | 6 votes |
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 15
Project: QN-ACTR-Release File: EpochPanel.java View source code | 6 votes |
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 16
Project: incubator-netbeans File: OperationWizardModel.java View source code | 6 votes |
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 17
Project: Equella File: MultiTargetChooser.java View source code | 6 votes |
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 18
Project: incubator-netbeans File: ActionsTest.java View source code | 6 votes |
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 19
Project: rapidminer File: PendingPurchasesInstallationDialog.java View source code | 6 votes |
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 20
Project: incubator-netbeans File: NodeSelectionProjectPanel.java View source code | 6 votes |
/** * 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 21
Project: Dahlem_SER316 File: CharTablePanel.java View source code | 6 votes |
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 22
Project: openjdk-jdk10 File: bug6219960.java View source code | 6 votes |
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 23
Project: incubator-netbeans File: IDEServicesImpl.java View source code | 6 votes |
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 24
Project: Community_Tieba-Data-Analyzer File: WebCrawler.java View source code | 6 votes |
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 25
Project: AgentWorkbench File: DynFormBase.java View source code | 6 votes |
/** * 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 26
Project: Tarski File: TypeWizard.java View source code | 6 votes |
/** * 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 27
Project: VASSAL-src File: BoardPicker.java View source code | 6 votes |
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 28
Project: incubator-netbeans File: BrokenReferencesImpl.java View source code | 5 votes |
@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 29
Project: geomapapp File: StartUp.java View source code | 5 votes |
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 30
Project: oxygen-git-plugin File: CommitPanel.java View source code | 5 votes |
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 31
Project: incubator-netbeans File: BrowseFolders.java View source code | 5 votes |
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 32
Project: incubator-netbeans File: HintsPanelLogic.java View source code | 5 votes |
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 33
Project: rapidminer File: FancyDropDownButton.java View source code | 5 votes |
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 34
Project: incubator-netbeans File: SourceRootsUi.java View source code | 5 votes |
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 35
Project: MTG-Card-Recognizer File: PopoutCardWindow.java View source code | 5 votes |
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 36
Project: propan-jogl-examples File: Example.java View source code | 5 votes |
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 37
Project: java-irc File: Channel.java View source code | 5 votes |
/** * 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 38
Project: Progetto-E File: GUIOperatoreLogin.java View source code | 5 votes |
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 39
Project: geomapapp File: LayerManager.java View source code | 5 votes |
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 View source code | 5 votes |
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); }