javax.swing.WindowConstants Java Examples
The following examples show how to use
javax.swing.WindowConstants.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: bug8136998.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void setupUI() { frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); comboBox = new JComboBox<>(ITEMS); JPanel scrollable = new JPanel(); scrollable.setLayout(new BoxLayout(scrollable, BoxLayout.Y_AXIS)); scrollable.add(Box.createVerticalStrut(200)); scrollable.add(comboBox); scrollable.add(Box.createVerticalStrut(200)); scrollPane = new JScrollPane(scrollable); frame.add(scrollPane); frame.setSize(100, 200); frame.setVisible(true); }
Example #2
Source File: ComplexDataset.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Shows the phase legend. */ public JFrame showLegend() { InteractivePanel panel = new InteractivePanel(); panel.setPreferredGutters(5, 5, 5, 25); DrawingFrame frame = new DrawingFrame(DisplayRes.getString("GUIUtils.PhaseLegend"), panel); //$NON-NLS-1$ frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.setJMenuBar(null); panel.addDrawable(new Phase()); XAxis xaxis = new XAxis(DisplayRes.getString("ComplexDataset.Legend.XAxis")); //$NON-NLS-1$ xaxis.setLocationType(XYAxis.DRAW_AT_LOCATION); xaxis.setEnabled(true); // enable the dragging panel.setClipAtGutter(false); panel.addDrawable(xaxis); panel.setSquareAspect(false); panel.setPreferredMinMax(-Math.PI, Math.PI, -1, 1); frame.setSize(300, 120); frame.setVisible(true); return frame; }
Example #3
Source File: ScreenMenuMemoryLeakTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void showUI() { sFrame = new JFrame(); sFrame.add(new JLabel("Some dummy content")); JMenuBar menuBar = new JMenuBar(); sMenu = new JMenu("Menu"); JMenuItem item = new JMenuItem("Item"); sMenu.add(item); sMenuItem = new WeakReference<>(item); menuBar.add(sMenu); sFrame.setJMenuBar(menuBar); sFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); sFrame.pack(); sFrame.setVisible(true); }
Example #4
Source File: MainGui.java From LambdaAttack with MIT License | 6 votes |
public MainGui(LambdaAttack botManager) { this.botManager = botManager; this.frame.setResizable(false); this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setLookAndFeel(); JPanel topPanel = setTopPane(); JScrollPane buttonPane = setButtonPane(); this.frame.add(topPanel, BorderLayout.PAGE_START); this.frame.add(buttonPane, BorderLayout.CENTER); this.frame.pack(); this.frame.setVisible(true); LambdaAttack.getLogger().info("Starting program"); }
Example #5
Source File: LogViewerFrame.java From usergrid with Apache License 2.0 | 6 votes |
public LogViewerFrame( App app ) throws IOException { super( "Log" ); this.app = app; // Add a scrolling text area textArea.setEditable( false ); textArea.setRows( 20 ); textArea.setColumns( 50 ); getContentPane().add( new JScrollPane( textArea ), BorderLayout.CENTER ); pack(); // setLocationRelativeTo(app.getLauncher()); setLocation( 100, 100 ); setDefaultCloseOperation( WindowConstants.HIDE_ON_CLOSE ); setVisible( false ); Log4jAppender appender = new Log4jAppender(); Logger.getRootLogger().addAppender( appender ); }
Example #6
Source File: OurDialog.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** Display a simple non-modal window showing some text. */ public static JFrame showtext(String title, String text) { JFrame window = new JFrame(title); JButton done = new JButton("Close"); done.addActionListener(Runner.createDispose(window)); JScrollPane scrollPane = OurUtil.scrollpane(OurUtil.textarea(text, 20, 60, false, false)); window.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); window.getContentPane().setLayout(new BorderLayout()); window.getContentPane().add(scrollPane, BorderLayout.CENTER); window.getContentPane().add(done, BorderLayout.SOUTH); window.pack(); window.setSize(500, 500); window.setLocationRelativeTo(null); window.setVisible(true); return window; }
Example #7
Source File: ScreenMenuMemoryLeakTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void showUI() { sFrame = new JFrame(); sFrame.add(new JLabel("Some dummy content")); JMenuBar menuBar = new JMenuBar(); sMenu = new JMenu("Menu"); JMenuItem item = new JMenuItem("Item"); sMenu.add(item); sMenuItem = new WeakReference<>(item); menuBar.add(sMenu); sFrame.setJMenuBar(menuBar); sFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); sFrame.pack(); sFrame.setVisible(true); }
Example #8
Source File: bug8136998.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void setupUI() { frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); comboBox = new JComboBox<>(ITEMS); JPanel scrollable = new JPanel(); scrollable.setLayout(new BoxLayout(scrollable, BoxLayout.Y_AXIS)); scrollable.add(Box.createVerticalStrut(200)); scrollable.add(comboBox); scrollable.add(Box.createVerticalStrut(200)); scrollPane = new JScrollPane(scrollable); frame.add(scrollPane); frame.setSize(100, 200); frame.setVisible(true); }
Example #9
Source File: ProgressLog.java From stendhal with GNU General Public License v2.0 | 6 votes |
/** * Create a new ProgressLog. * * @param name name of the window */ ProgressLog(String name) { window = new JDialog(j2DClient.get().getMainFrame(), name); tabs = new JTabbedPane(); tabs.setPreferredSize(new Dimension(PAGE_WIDTH, PAGE_HEIGHT)); tabs.addChangeListener(new TabChangeListener()); WindowUtils.closeOnEscape(window); window.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); window.add(tabs); window.pack(); WindowUtils.watchFontSize(window); WindowUtils.trackLocation(window, "travel_log", true); WtWindowManager.getInstance().registerSettingChangeListener("ui.logfont", new SettingChangeAdapter("ui.logfont", FONT_NAME) { @Override public void changed(String newValue) { fontName = newValue; for (Page page : pages) { page.setFontName(newValue); } } }); }
Example #10
Source File: PageCommentsWindow.java From wpcleaner with Apache License 2.0 | 6 votes |
/** * Create and display a PageCommentsWindow. * * @param page Page. * @param wikipedia Wikipedia. */ public static void createPageCommentsWindow( final Page page, EnumWikipedia wikipedia) { createWindow( "PageCommentsWindow", wikipedia, WindowConstants.DISPOSE_ON_CLOSE, PageCommentsWindow.class, new DefaultBasicWindowListener() { @Override public void initializeWindow(BasicWindow window) { if (window instanceof PageCommentsWindow) { PageCommentsWindow pageComments = (PageCommentsWindow) window; pageComments.page = page; } } }); }
Example #11
Source File: Popup401.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void createAndShowGUI() { frame = new JFrame("HangPopupTest"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setSize(1000, 1000); test = new Popup401(); frame.add(test); frame.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { super.componentShown(e); test.run(); synchronized (testCompleted) { testCompleted.notifyAll(); } } }); frame.pack(); frame.setVisible(true); }
Example #12
Source File: GraphDisplayer.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 6 votes |
void addWindow() { Bundle newB; final Bundle[] bl = Activator.desktop.getSelectedBundles(); if(bl != null && bl.length > 0) { newB = bl[0]; } else { newB = Activator.getTargetBC_getBundle(0); } final JMainBundles comp = new JMainBundles(newB); comp.frame = new JFrame(makeTitle(newB)); comp.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); comp.frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { comp.close(); } }); comp.frame.getContentPane().add(comp); comp.frame.pack(); comp.frame.setVisible(true); windows.add(comp); }
Example #13
Source File: EasikFrame.java From CQL with GNU Affero General Public License v3.0 | 6 votes |
/** * * * @param title */ public EasikFrame(String title) { super(title); getContentPane().setBackground(Color.white); _settings = Easik.getInstance().getSettings(); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { closeWindow(); } }); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); }
Example #14
Source File: PCGenFrame.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private void initSettings() { setSize(1060, 725); //this is the default frame dimensions setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { PCGenUIManager.closePCGen(); } }); }
Example #15
Source File: SpellChoiceDialog.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
/** * Create a new instance of SpellChoiceDialog * @param frame The parent frame we are displaying over. */ public SpellChoiceDialog(JFrame frame, SpellBuilderFacade builder) { super(frame, true); setTitle(LanguageBundle.getString("in_csdChooseSpell")); this.spellChoicePanel = new SpellChoicePanel(builder); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); Utility.installEscapeCloseOperation(this); initComponents(); pack(); }
Example #16
Source File: DependencyViewerStandalone.java From gradle-view with Apache License 2.0 | 5 votes |
public DependencyViewerStandalone() { super(TITLE); this.dependencyCellRenderer = new DependencyCellRenderer(); this.information = new JTextArea(); this.information.setEditable(false); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setSize(1024, 768); setLocation(128, 128); initMenu(); initToolingLogger(); initContent(); }
Example #17
Source File: ProgressDialog.java From Hook-Manager with Mozilla Public License 2.0 | 5 votes |
/** * Create the dialog. */ public ProgressDialog() { setUndecorated(true); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setAlwaysOnTop(true); setResizable(false); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); setBounds(screen.width - 450, 0, 450, 200); getContentPane().setLayout( new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); Component glue = Box.createGlue(); getContentPane().add(glue); JLabel lblImage = new JLabel("HookManager"); lblImage.setFont(new Font("Verdana", Font.BOLD, 40)); lblImage.setAlignmentX(Component.CENTER_ALIGNMENT); lblImage.setHorizontalAlignment(SwingConstants.CENTER); getContentPane().add(lblImage); { lblProgress = new JLabel("<html>\r\n<center>\r\n<h1>Updating...</h1>"); lblProgress.setAlignmentX(Component.CENTER_ALIGNMENT); lblProgress.setFont(new Font("Verdana", Font.PLAIN, 16)); getContentPane().add(lblProgress); lblProgress.setHorizontalAlignment(SwingConstants.CENTER); } Component glue_1 = Box.createGlue(); getContentPane().add(glue_1); }
Example #18
Source File: SystemPropertiesFrame.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Constructs a standard frame that displays system properties. * <P> * If a menu is requested, it provides a menu item that allows the user to * copy the contents of the table to the clipboard in tab-delimited format. * * @param menu flag indicating whether or not the frame should display a * menu to allow the user to copy properties to the clipboard. */ public SystemPropertiesFrame(final boolean menu) { final String baseName = "org.jfree.ui.about.resources.AboutResources"; final ResourceBundle resources = ResourceBundleWrapper.getBundle( baseName); final String title = resources.getString("system-frame.title"); setTitle(title); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); if (menu) { setJMenuBar(createMenuBar(resources)); } final JPanel content = new JPanel(new BorderLayout()); this.panel = new SystemPropertiesPanel(); this.panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); content.add(this.panel, BorderLayout.CENTER); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); final String label = resources.getString("system-frame.button.close"); final Character mnemonic = (Character) resources.getObject( "system-frame.button.close.mnemonic"); final JButton closeButton = new JButton(label); closeButton.setMnemonic(mnemonic.charValue()); closeButton.setActionCommand(CLOSE_COMMAND); closeButton.addActionListener(this); buttonPanel.add(closeButton, BorderLayout.EAST); content.add(buttonPanel, BorderLayout.SOUTH); setContentPane(content); }
Example #19
Source File: EquipCustomizerDialog.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
/** * Create a new instance of KitSelectionDialog * @param frame The parent frame we are displaying over. * @param character The character being displayed. */ public EquipCustomizerDialog(JFrame frame, CharacterFacade character, EquipmentBuilderFacade builder) { super(frame, true); setTitle(LanguageBundle.getString("in_itemCustomizer")); this.equipCustomPanel = new EquipCustomPanel(character, builder); setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); initComponents(); pack(); }
Example #20
Source File: ChartFrame.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Constructs a frame for a chart. * * @param title the frame title. * @param chart the chart. * @param scrollPane if <code>true</code>, put the Chart(Panel) into a * JScrollPane. */ public ChartFrame(String title, JFreeChart chart, boolean scrollPane) { super(title); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.chartPanel = new ChartPanel(chart); if (scrollPane) { setContentPane(new JScrollPane(this.chartPanel)); } else { setContentPane(this.chartPanel); } }
Example #21
Source File: Main.java From dctb-utfpr-2018-1 with Apache License 2.0 | 5 votes |
public static void main(String args[]){ Main novaApp = new Main(); novaApp.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); novaApp.setSize(new Dimension(800, 610)); novaApp.add(new PokemonPanelForm()); novaApp.setVisible(true); }
Example #22
Source File: Main.java From dctb-utfpr-2018-1 with Apache License 2.0 | 5 votes |
public static void main(String args[]) { Main me = new Main(); me.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); me.setSize(new Dimension(500, 410)); me.add(new PokemonPanelForm()); me.setVisible(true); }
Example #23
Source File: Main.java From dctb-utfpr-2018-1 with Apache License 2.0 | 5 votes |
public static void main(String args[]) { Main me = new Main(); me.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); me.setSize(new Dimension(500, 410)); me.add(new CoursePanelForm()); me.setVisible(true); }
Example #24
Source File: LinearGradientPrintingTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void createUI() { f = new JFrame("LinearGradient Printing Test"); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final LinearGradientPrintingTest gpt = new LinearGradientPrintingTest(); Container c = f.getContentPane(); c.add(BorderLayout.CENTER, gpt); final JButton print = new JButton("Print"); print.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(gpt); final boolean doPrint = job.printDialog(); if (doPrint) { try { job.print(); } catch (PrinterException ex) { throw new RuntimeException(ex); } } } }); c.add(print, BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Example #25
Source File: DateTimeBrowser.java From astor with GNU General Public License v2.0 | 5 votes |
private void go(String[] args) { mainArgs = args; setDefaultTimeZone(); // let user override if needed // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); // JMenuBar menuBar = new JMenuBar(); setJMenuBar( menuBar ); addMenus( menuBar ); /* * Add a fast close listener */ addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible( false ); dispose(); System.exit(0); } } ); // // Load current file, prime tables and JFrame. // currFile = new LoadedFile( mainArgs[0] ); TableView tView = getDefaultTableView(); resetDefaults( tView ); // // Set max size at start, and display the window. // Dimension screenMax = Toolkit.getDefaultToolkit().getScreenSize(); setSize ( screenMax ); setVisible(true); }
Example #26
Source File: TexturePaintPrintingTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void printTexture() { f = new JFrame("Texture Printing Test"); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final TexturePaintPrintingTest gpt = new TexturePaintPrintingTest(); Container c = f.getContentPane(); c.add(BorderLayout.CENTER, gpt); final JButton print = new JButton("Print"); print.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(gpt); final boolean doPrint = job.printDialog(); if (doPrint) { try { job.print(); } catch (PrinterException ex) { throw new RuntimeException(ex); } } } }); c.add(print, BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Example #27
Source File: LAICPMSProjectParametersManager.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * @return */ public JDialog displayModelInFrame() { parametersViewDialog = new ProjectParametersViewDialog(null, true); parametersViewDialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); parametersViewDialog.setBounds( // 400, 400, // (int) parentDimension.getWidth(), (int) parentDimension.getHeight()); //Get the screen size Toolkit toolkit = Toolkit.getDefaultToolkit(); Dimension screenSize = toolkit.getScreenSize(); //Calculate the frame location int x = (screenSize.width - (int) parentDimension.getWidth()) / 2; int y = (screenSize.height - (int) parentDimension.getHeight()) / 2; //Set the new frame location centered parametersViewDialog.setLocation(uPbReduxFrame.getX() - 100, y); parametersViewDialog.add(this); parametersViewDialog.setVisible(true); parametersViewDialog.toFront(); return parametersViewDialog; }
Example #28
Source File: TexturePaintPrintingTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void printTexture() { f = new JFrame("Texture Printing Test"); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); final TexturePaintPrintingTest gpt = new TexturePaintPrintingTest(); Container c = f.getContentPane(); c.add(BorderLayout.CENTER, gpt); final JButton print = new JButton("Print"); print.addActionListener(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(gpt); final boolean doPrint = job.printDialog(); if (doPrint) { try { job.print(); } catch (PrinterException ex) { throw new RuntimeException(ex); } } } }); c.add(print, BorderLayout.SOUTH); f.pack(); f.setVisible(true); }
Example #29
Source File: LoneOptionDialog.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * Show a message dialog with specified, selectable message. * * @param message message string * @param title title of the dialog window * @param messageType type of the message. These are specified in * JOptionDialog */ static void showMessageDialog(String message, String title, int messageType) { JOptionPane pane = new JOptionPane(new SelectableLabel(message), messageType); JDialog dialog = pane.createDialog(title); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); setLocation(dialog); dialog.setVisible(true); dialog.dispose(); }
Example #30
Source File: PdfExportPlugin.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates the progress dialog that monitors the export process. * * @return the progress monitor dialog. */ protected ReportProgressDialog createProgressDialog() { final ReportProgressDialog progressDialog = super.createProgressDialog(); progressDialog.setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); progressDialog.setMessage( resources.getString( "pdf-export.progressdialog.message" ) ); //$NON-NLS-1$ progressDialog.pack(); LibSwingUtil.positionFrameRandomly( progressDialog ); return progressDialog; }