/** * Gets the authorization dialog. * * @param presetUsername username which should be shown preset when displaying the dialog * @param owner the window to which the dialog should belong (to center etc.) * @return the dialog */ public JDialog getDialog(String presetUsername, Window owner) { authDialog = new JDialog(owner); OIDCPanel oidcPanel = new OIDCPanel(this); if (presetUsername != null) { oidcPanel.getJTextFieldUsername().setText(presetUsername); } authDialog.setContentPane(oidcPanel); authDialog.setSize(new Dimension(500, 190)); authDialog.setLocationRelativeTo(null); return authDialog; }
void initDialog() { dialog = new JDialog( // dialog = new JFrame( (JFrame)grid.getTopLevelAncestor(), "Grid Rendering Tools"); tabs = new JTabbedPane(JTabbedPane.TOP); tabs.add( "Rendering", this); dialog.getContentPane().add(tabs); JLabel label = new JLabel("Rendering tools are new " +"and still under development - " +"use with caution"); dialog.getContentPane().add(label, "South"); dialog.pack(); tabs.add( "3D", pers); tabs.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { tabChange(); } }); }
@Override public JDialog create(Consumer<JPanel> consumer) { try { window.setIconImage(new ImageIcon(ImageIO.read(getClass().getResourceAsStream("/VISNode_64.png"))).getImage()); } catch (IOException ex) { ExceptionHandler.get().handle(ex); } JPanel container = new JPanel(new BorderLayout()); container.setBorder(new CompoundBorder(new EmptyBorder(3, 3, 3, 3), new CompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(6, 6, 6, 6)))); consumer.accept(container); window.getContentPane().setLayout(new BorderLayout()); window.getContentPane().add(container); window.pack(); window.setLocationRelativeTo(null); return window; }
private static boolean showUpgradeDialog (final File source, String note) { Util.setDefaultLookAndFeel(); JPanel panel = new JPanel(new BorderLayout()); panel.add(new AutoUpgradePanel (source.getAbsolutePath (), note), BorderLayout.CENTER); JProgressBar progressBar = new JProgressBar(0, 100); progressBar.setValue(0); progressBar.setStringPainted(true); progressBar.setIndeterminate(true); panel.add(progressBar, BorderLayout.SOUTH); progressBar.setVisible(false); JButton bYES = new JButton("Yes"); bYES.setMnemonic(KeyEvent.VK_Y); JButton bNO = new JButton("No"); bNO.setMnemonic(KeyEvent.VK_N); JButton[] options = new JButton[] {bYES, bNO}; JOptionPane p = new JOptionPane (panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, options, bYES); JDialog d = Util.createJOptionProgressDialog(p, NbBundle.getMessage (AutoUpgrade.class, "MSG_Confirmation_Title"), source, progressBar); d.setVisible (true); return new Integer (JOptionPane.YES_OPTION).equals (p.getValue ()); }
/** * Creates and returns a fresh dialog for the given frame. */ private JDialog createDialog(Component frame) { Object[] buttons = new Object[] {getOkButton(), getCancelButton()}; // input panel with text area and choice box JPanel input = new JPanel(); input.setLayout(new BorderLayout()); input.setPreferredSize(new Dimension(300, 150)); input.add(new JLabel("<html><b>Enter value:"), BorderLayout.NORTH); input.add(new JScrollPane(getTextArea()), BorderLayout.CENTER); input.add(getChoiceBox(), BorderLayout.SOUTH); JPanel main = new JPanel(); main.setLayout(new BorderLayout()); main.add(input, BorderLayout.CENTER); if (this.parsed) { JPanel errorPanel = new JPanel(new BorderLayout()); errorPanel.add(getErrorLabel()); main.add(errorPanel, BorderLayout.SOUTH); main.add(createSyntaxPanel(), BorderLayout.EAST); } JOptionPane panel = new JOptionPane(main, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, buttons); JDialog result = panel.createDialog(frame, this.title); result.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); result.addWindowListener(this.closeListener); return result; }
private CopyFiles(File source, File target, File patternsFile) { this.sourceRoot = source; this.targetRoot = target; try { InputStream is = new FileInputStream(patternsFile); Reader reader = new InputStreamReader(is, "utf-8"); // NOI18N readPatterns(reader); reader.close(); } catch (IOException ex) { // set these to null to stop further copying (see copyDeep method) sourceRoot = null; targetRoot = null; LOGGER.log(Level.WARNING, "Import settings will not proceed: {0}", ex.getMessage()); // show error message and continue JDialog dialog = Util.createJOptionDialog(new JOptionPane(ex, JOptionPane.ERROR_MESSAGE), "Import settings will not proceed"); dialog.setVisible(true); return; } }
public void actionPerformed(ActionEvent e) { if (!isEnabled()) return; TermOptions clonedTermOptions = termOptions.makeCopy(); TermOptionsPanel subPanel = new TermOptionsPanel(); subPanel.setTermOptions(clonedTermOptions); JOptionPane optionPane = new JOptionPane(subPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION ); JDialog dialog = optionPane.createDialog(Terminal.this, "NBTerm Options"); dialog.setVisible(true); // WILL BLOCK! if (optionPane.getValue() == null) return; // was closed at the window level switch ((Integer) optionPane.getValue()) { case JOptionPane.OK_OPTION: System.out.printf("Dialog returned OK\n"); termOptions.assign(clonedTermOptions); applyTermOptions(false); termOptions.storeTo(prefs); break; case JOptionPane.CANCEL_OPTION: System.out.printf("Dialog returned CANCEL\n"); break; case JOptionPane.CLOSED_OPTION: System.out.printf("Dialog returned CLOSED\n"); break; default: System.out.printf("Dialog returned OTHER: %s\n", optionPane.getValue()); break; } }
public static void createAndShowGUI() { frame = new JFrame("JFrame"); frame.setSize(WIDTH, HEIGHT); frame.setLocation(100, 300); dialog = new JDialog(frame, false); dialog.setSize(250, 250); dialog.setUndecorated(true); dialog.setLocation(400, 300); dlgPos = dialog.getLocation(); backgroundDialog = new JDialog(frame, false); backgroundDialog.setSize(250, 250); backgroundDialog.getContentPane().setBackground(Color.red); backgroundDialog.setLocation(dlgPos.x, dlgPos.y); frame.setVisible(true); backgroundDialog.setVisible(true); dialog.setVisible(true); }
/** Helper method for constructing an always-on-top modal dialog. */ private static Object show(String title, int type, Object message, Object[] options, Object initialOption) { if (options == null) { options = new Object[] { "Ok" }; initialOption = "Ok"; } JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption); p.setInitialValue(initialOption); JDialog d = p.createDialog(null, title); p.selectInitialValue(); d.setAlwaysOnTop(true); d.setVisible(true); d.dispose(); return p.getValue(); }
@Override public void actionPerformed(ActionEvent ae) { if (ae.getSource()==this.button) { //The user has clicked the cell, so bring up the dialog. button.setBackground(currentColor); //Set up the dialog that the button brings up. colorChooser = new JColorChooser(); colorChooser.setColor(currentColor); JDialog dialog = JColorChooser.createDialog(button, "Pick a Color", true, colorChooser, this, null); dialog.setVisible(true); // --- From here: user action in the dialog --- fireEditingStopped(); } else { //User pressed dialog's "OK" button. currentColor = colorChooser.getColor(); } }
public static Color showDialog(Component component, String title, Color initial) { JColorChooser choose = new JColorChooser(initial); JDialog dialog = createDialog(component, title, true, choose, null, null); AbstractColorChooserPanel[] panels = choose.getChooserPanels(); for (AbstractColorChooserPanel accp : panels) { choose.removeChooserPanel(accp); } GrayScaleSwatchChooserPanel grayScaleSwatchChooserPanelFreeStyle = new GrayScaleSwatchChooserPanel(); GrayScalePanel grayScalePanelFreeStyle = new GrayScalePanel(); choose.addChooserPanel(grayScaleSwatchChooserPanelFreeStyle); choose.addChooserPanel(grayScalePanelFreeStyle); dialog.getContentPane().add(choose); dialog.pack(); dialog.setVisible(true);//.show(); return choose.getColor(); }
void handleAbout() { //#221571 - check if About window is showing already Window[] windows = Dialog.getWindows(); if( null != windows ) { for( Window w : windows ) { if( w instanceof JDialog ) { JDialog dlg = (JDialog) w; if( Boolean.TRUE.equals(dlg.getRootPane().getClientProperty("nb.about.dialog") ) ) { //NOI18N if( dlg.isVisible() ) { dlg.toFront(); return; } } } } } performAction("Help", "org.netbeans.core.actions.AboutAction"); // NOI18N }
public static ProgressDialog showProgress(Component parent, String message) { JDialog d = ComponentHelper.createJDialog(parent); ProgressDialog p = new ProgressDialog(d); d.getRootPane().setWindowDecorationStyle(JRootPane.INFORMATION_DIALOG); d.setResizable(false); d.setContentPane(p); d.setTitle(message); d.pack(); d.setLocationRelativeTo(parent); d.setVisible(true); return p; }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { //JOptionPane pane = new JOptionPane(); //pane.setMessageType(JOptionPane.INFORMATION_MESSAGE); JDialog dialog = new JDialog((Frame)null, "Result of COAP GET for bulb " + bulb.getName(), false); JTextArea msg = new JTextArea(bulb.getJsonObject().toString(4) + "\n"); msg.setFont(new Font("monospaced", Font.PLAIN, 10)); msg.setLineWrap(true); msg.setWrapStyleWord(true); JScrollPane scrollPane = new JScrollPane(msg); dialog.getContentPane().add(scrollPane); dialog.setSize(350, 350); //dialog.pack(); dialog.setVisible(true); } catch (JSONException ex) { Logger.getLogger(BulbPanel.class.getName()).log(Level.SEVERE, null, ex); } }
/** Popup the given informative message, then ask the user to click Close to close it. */ public static void showmsg(String title, Object... msg) { JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close"); Object[] objs = new Object[msg.length + 1]; System.arraycopy(msg, 0, objs, 0, msg.length); objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null); JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{}); JDialog dialog = about.createDialog(null, title); dismiss.addActionListener(Runner.createDispose(dialog)); dialog.setAlwaysOnTop(true); dialog.setVisible(true); dialog.dispose(); }
private void initializeChooseColumnDialog( String input ) { String tempURLString = null; if ( hole.getLeg() < 100 ) { tempURLString = DSDP.DSDP_PATH + input + "/" + hole.toString() + "-" + input + ".txt"; } else { tempURLString = DSDP.DSDP_PATH + "ODP_" + input + "/" + hole.toString() + "-" + input + ".txt"; } try { DensityBRGTable tempTable = new DensityBRGTable(tempURLString); selectSedimentDialog = new JDialog(dsdpF); selectSedimentDialog.setTitle("Select Column"); selectSedimentDialog.addWindowListener(this); selectAddColumnCB = new JComboBox(); selectAddColumnCB.addItem("Select Column"); for ( int i = 1; i < tempTable.headings.length; i++ ) { selectAddColumnCB.addItem(tempTable.headings[i]); } selectAddColumnCB.addItemListener(this); selectSedimentDialog.add(selectAddColumnCB); selectSedimentDialog.pack(); selectSedimentDialog.setSize( 195, 100 ); selectSedimentDialog.setLocation( selectSedimentDialogX, selectSedimentDialogY ); selectSedimentDialog.setVisible(true); } catch (IOException ioe) { ioe.printStackTrace(); } }
public static void setFor(JDialog w) { if (icons == null) return; if (setIconImages != null) { setIconImages(w); } else { // Give up. JDialog has no setIconImage() method. } }
/** Returns the content pane of our owner, so as to display the wait * cursor while the dialog is being invoked */ @Override public Component getCursorChangeComponent() { Container cont = SheetTable.this.getTopLevelAncestor(); return (cont instanceof JFrame) ? ((JFrame) cont).getContentPane() : ((cont instanceof JDialog) ? ((JDialog) cont).getContentPane() : cont); }
private static void showDialog(JFrame parent) throws Exception { jd = new JDialog(parent); jtf = new JTextField("What a day I'm having!"); jd.getContentPane().setLayout(new BorderLayout()); jd.getContentPane().add(jtf, BorderLayout.CENTER); jd.setBounds(400,400,100, 50); new WaitWindow(jd); sleep(); }
/** * Maps {@code JDialog.getDefaultCloseOperation()} through queue */ public int getDefaultCloseOperation() { return (runMapping(new MapIntegerAction("getDefaultCloseOperation") { @Override public int map() { return ((JDialog) getSource()).getDefaultCloseOperation(); } })); }
/** * Sets the title. * @param title the new title */ private void setTitle(String title) { Container progressCont = this.getProgressMonitorContainer(); if (progressCont instanceof JDialog) { ((JDialog) progressCont).setTitle(title); } else if (progressCont instanceof JInternalFrame) { ((JInternalFrame) progressCont).setTitle(title); } }
/** * Maps {@code JDialog.setGlassPane(Component)} through queue */ public void setGlassPane(final Component component) { runMapping(new MapVoidAction("setGlassPane") { @Override public void map() { ((JDialog) getSource()).setGlassPane(component); } }); }
public ProcessingDialog(JFrame owner, JComponent map) { super((JFrame) null, "Processing...", false); this.owner = owner; this.map = map; tasksPanel = new JPanel(); tasksPanel.setLayout( new BoxLayout(tasksPanel, BoxLayout.Y_AXIS)); tasksPanel.setBorder(BorderFactory.createEmptyBorder(3,3,3,3)); getContentPane().add(tasksPanel); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); setMinimumSize(new Dimension(200,40)); setAlwaysOnTop(true); }
public LogVisualizer(JDialog d) { this.d = d; this.setLayout(new BorderLayout()); logList = new JList(new DefaultListModel()); JScrollPane p = new JScrollPane(logList); this.add(p, BorderLayout.CENTER); loadData(); }
/** * 关闭遮罩层 */ private void dispose() { JDialog.setDefaultLookAndFeelDecorated(true); if (dialog != null) { dialog.dispose(); } if (timer != null) { timer.cancel(); } }
private void closeDialog(java.awt.Component c) { if (c instanceof JDialog) { ((JDialog) c).setVisible(false); } else { c = c.getParent(); if (c != null) { closeDialog(c); } } }
public static void main(String[] args) { JColorChooser chooser = new JColorChooser(COLOR); JDialog dialog = Test4177735.show(chooser); PropertyChangeListener listener = new Test4234761(); chooser.addPropertyChangeListener("color", listener); // NON-NLS: property name JTabbedPane tabbedPane = (JTabbedPane) chooser.getComponent(0); tabbedPane.setSelectedIndex(1); // HSB tab index if (!chooser.getColor().equals(COLOR)) { listener.propertyChange(null); } dialog.dispose(); }
/** * Launch the application. */ public static void main(String[] args) { try { AddFacultyForm dialog = new AddFacultyForm(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
/** Shows the content of this table as a dialog. */ public void showDialog(Component parent, String title) { JScrollPane scrollPane = new JScrollPane(this); scrollPane.getViewport().setPreferredSize(getPreferredSize()); JOptionPane optionPane = new JOptionPane(scrollPane, JOptionPane.PLAIN_MESSAGE); JDialog dialog = optionPane.createDialog(parent, title); dialog.setVisible(true); }
/** * Hides the associated toolbar by removing it from its dock or by closing * its client floating frame. */ public void hideToolBar() { final Container target = ourDockLayout.getTargetContainer(); target.remove(ourToolBar); final JDialog floatFrame = getFloatingFrame(); if (floatFrame != null) { floatFrame.setVisible(false); floatFrame.getContentPane().remove(ourToolBar); } target.validate(); target.repaint(); }
@Override public Dialog createDialog(DialogDescriptor descriptor) { lastDescriptor = descriptor; return new JDialog() { @SuppressWarnings("deprecation") @Override public void show() { } }; }
public static void open() { SetDialog dialog = new SetDialog(); dialog.setTitle("设置"); dialog.setModal(true); dialog.setResizable(false); dialog.setSize(400, 270); ShowHelper.showCenter(dialog); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); }
public Dialog createDialog(DialogDescriptor descriptor) { assertAWT(); return new JDialog() { public void setVisible(boolean v) { } }; }
/** * Maps {@code JDialog.getContentPane()} through queue */ public Container getContentPane() { return (runMapping(new MapAction<Container>("getContentPane") { @Override public Container map() { return ((JDialog) getSource()).getContentPane(); } })); }
/** * Launch the application. */ public static void main(String[] args) { try { StudentUpdateForm dialog = new StudentUpdateForm(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
public void testNoDefaultClose() { DialogDescriptor dd = new DialogDescriptor("Test", "Test dialog"); NbPresenter dlg = new NbPresenter( dd, (Dialog)null, true ); assertEquals( "default close operation is DISPOSE", JDialog.DISPOSE_ON_CLOSE, dlg.getDefaultCloseOperation() ); dd.setNoDefaultClose( true ); assertEquals( JDialog.DO_NOTHING_ON_CLOSE, dlg.getDefaultCloseOperation() ); dd.setNoDefaultClose( false ); assertEquals( JDialog.DISPOSE_ON_CLOSE, dlg.getDefaultCloseOperation() ); }
/** * Shows the dialog, and returns {@code true} if the user chose to continue. * Afterwards, {@link #getBound()} shows the next bound to which to explore. */ public boolean ask(Frame owner) { getMessageLabel().setText(String.format("Exploration has generated %s states", getBound())); getBoundSpinnerModel().setMinimum(getBound() + 1); getBoundSpinnerModel().setValue(getBound() * 2); JDialog dialog = createDialog(owner); dialog.setVisible(true); dialog.dispose(); return this.answer; }
public static JDialog createJOptionProgressDialog(JOptionPane p, String title, File source, JProgressBar bar) { progressBar = bar; sourceFolder = source; Object[] options = p.getOptions(); JButton bYES = ((JButton) options[0]); JButton bNO = ((JButton) options[1]); OptionsListener listener = new OptionsListener(p, bYES, bNO); bYES.addActionListener(listener); bNO.addActionListener(listener); return createJOptionDialog(p, title); }
/** * Initialize all gui-related stuff */ private void initGUI() { // Sets default title, close operation and dimensions this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); this.setTitle("Simulation Results..."); this.setIconImage(JMTImageLoader.loadImage("Results").getImage()); this.centerWindow(800, 600); // Creates all tabs JTabbedPane mainPanel = new JTabbedPane(); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(mainPanel, BorderLayout.CENTER); addTabPane(mainPanel, "Number of Customers", DESCRIPTION_QUEUELENGTHS, results.getQueueLengthMeasures()); addTabPane(mainPanel, "Queue Time", DESCRIPTION_QUEUETIMES, results.getQueueTimeMeasures()); addTabPane(mainPanel, "Residence Time", DESCRIPTION_RESIDENCETIMES, results.getResidenceTimeMeasures()); addTabPane(mainPanel, "Response Time", DESCRIPTION_RESPONSETIMES, results.getResponseTimeMeasures()); addTabPane(mainPanel, "Utilization", DESCRIPTION_UTILIZATIONS, results.getUtilizationMeasures()); addTabPane(mainPanel, "Throughput", DESCRIPTION_THROUGHPUTS, results.getThroughputMeasures()); addTabPane(mainPanel, "Drop Rate", DESCRIPTION_DROPRATE, results.getDropRateMeasures()); addTabPane(mainPanel, "System Throughput", DESCRIPTION_SYSTEMTHROUGHPUTS, results.getSystemThroughputMeasures()); addTabPane(mainPanel, "System Response Time", DESCRIPTION_SYSTEMRESPONSETIMES, results.getSystemResponseTimeMeasures()); addTabPane(mainPanel, "System Drop Rate", DESCRIPTION_DROPRATE, results.getSystemDropRateMeasures()); addTabPane(mainPanel, "System Number of Customers", DESCRIPTION_CUSTOMERNUMBERS, results.getCustomerNumberMeasures()); //Added by ASHANKA START //Adds the System Power panel in the results window. addTabPane(mainPanel, "System Power", DESCRIPTION_SYSTEMPOWER, results.getSystemPowerMeasures()); //Added by ASHANKA STOP addTabPane(mainPanel, SimulationDefinition.MEASURE_R_PER_SINK, DESCRIPTION_RESPONSETIME_SINK, results.getResponsetimePerSinkMeasures()); addTabPane(mainPanel, SimulationDefinition.MEASURE_X_PER_SINK, DESCRIPTION_THROUGHPUT_SINK, results.getThroughputPerSinkMeasures()); }
private static JDialog findBottomDialog(JDialog dialog, ComponentChooser chooser) { Window owner = dialog.getOwner(); if (chooser.checkComponent(owner)) { return (findBottomDialog((JDialog) owner, chooser)); } return (dialog); }