List of usage examples for javax.swing WindowConstants DO_NOTHING_ON_CLOSE
int DO_NOTHING_ON_CLOSE
To view the source code for javax.swing WindowConstants DO_NOTHING_ON_CLOSE.
Click Source Link
From source file:uk.ac.abdn.csd.p2p.server.ServerGUI.java
/** * This method prepares all the graphical components that are contained with P2P Visualisation Server. *//*from w ww .j av a2 s . c o m*/ // <editor-fold defaultstate="collapsed" desc="...GUI"> private void initializeComponent() { listeningPort = 0; JFrame frame = new JFrame(); BorderLayout layout = new BorderLayout(); //create a graph overlay = new UndirectedSparseGraph<Vertex, Edge>(); ObservableGraph<Vertex, Edge> og = new ObservableGraph<Vertex, Edge>(overlay); /* og.addGraphEventListener(new GraphEventListener<Vertex, Edge>() { @Override public void handleGraphEvent( GraphEvent<Vertex, Edge> evt) { System.err.println("got " + evt); } });*/ this.overlay = og; layout1 = new FRLayout2<Vertex, Edge>(overlay); vv = new VisualizationViewer<Vertex, Edge>(layout1, new Dimension(700, 200)); vv.setGraphMouse(new DefaultModalGraphMouse<Vertex, Edge>()); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Vertex>()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<Edge>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); vv.getRenderContext().setVertexFillPaintTransformer(new VertexPainter()); DefaultModalGraphMouse gm1 = new DefaultModalGraphMouse(); gm1.setMode(ModalGraphMouse.Mode.TRANSFORMING); gm1.setMode(ModalGraphMouse.Mode.PICKING); gm1.add(new MyPopupGraphMousePlugin()); vv.setGraphMouse(gm1); vv.addKeyListener(gm1.getModeKeyListener()); contentPane = new JPanel(layout); displayPanel = new javax.swing.JPanel(); consoleTextArea = new JTextArea(); jScrollPane2 = new JScrollPane(); clearButton = new JButton(); consolePanel = new JPanel(); clearButton = new javax.swing.JButton(); nodeTextArea = new JTextArea(); jScrollPane1 = new JScrollPane(); nodePanel = new JPanel(); linkTextArea = new JTextArea(); jScrollPane3 = new JScrollPane(); linkPanel = new JPanel(); menuBar = new javax.swing.JMenuBar(); serverMenu = new javax.swing.JMenu(); startServerMenuItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JPopupMenu.Separator(); exitMenuItem = new javax.swing.JMenuItem(); editMenu = new javax.swing.JMenu(); settingMenuItem = new javax.swing.JMenuItem(); colorSettingMenuItem = new javax.swing.JMenuItem(); toolMenuItem = new javax.swing.JMenu(); clearMenuItem = new javax.swing.JMenuItem(); helpMenu = new javax.swing.JMenu(); aboutMenuItem = new javax.swing.JMenuItem(); zoominMenuItem = new javax.swing.JMenuItem(); zoomoutMenuItem = new javax.swing.JMenuItem(); layoutSettingMenuItem = new javax.swing.JMenuItem(); labelPositionMenuItem = new javax.swing.JMenuItem(); speedSettingMenuItem = new javax.swing.JMenuItem(); topologySettingMenuItem = new javax.swing.JMenuItem(); findNodeMenuItem = new javax.swing.JMenuItem(); serverMenu.setText("Server"); serverMenu.setToolTipText("Server"); startServerMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK)); startServerMenuItem.setText("Start Server"); startServerMenuItem.setToolTipText("Start Server"); startServerMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { startServerMenuItemActionPerformed(evt); } }); serverMenu.add(startServerMenuItem); serverMenu.add(jSeparator1); exitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK)); exitMenuItem.setText("Exit"); exitMenuItem.setToolTipText("Exit"); exitMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); serverMenu.add(exitMenuItem); menuBar.add(serverMenu); editMenu.setText("Edit"); editMenu.setToolTipText("Edit"); settingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK)); settingMenuItem.setText("Server Settings"); settingMenuItem.setToolTipText("Server Settings"); settingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { settingMenuItemActionPerformed(evt); } }); editMenu.add(settingMenuItem); colorSettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.ALT_MASK)); colorSettingMenuItem.setText("Colour Settings"); colorSettingMenuItem.setToolTipText("Colour Settings"); colorSettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { colorSettingMenuItemActionPerformed(evt); } }); editMenu.add(colorSettingMenuItem); layoutSettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.ALT_MASK)); layoutSettingMenuItem.setText("Layout Settings"); layoutSettingMenuItem.setToolTipText("Layout Settings"); layoutSettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { layoutSettingMenuItemActionPerformed(evt); } }); editMenu.add(layoutSettingMenuItem); speedSettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.ALT_MASK)); speedSettingMenuItem.setText("Speed Settings"); speedSettingMenuItem.setToolTipText("Speed Settings"); speedSettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { speedSettingMenuItemActionPerformed(evt); } }); editMenu.add(speedSettingMenuItem); topologySettingMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK)); topologySettingMenuItem.setText("Topology Settings"); topologySettingMenuItem.setToolTipText("Topology Settings"); topologySettingMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { topologySettingMenuItemActionPerformed(evt); } }); editMenu.add(topologySettingMenuItem); menuBar.add(editMenu); toolMenuItem.setText("Tools"); toolMenuItem.setToolTipText("Tools"); labelPositionMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK)); labelPositionMenuItem.setText("Vertex Label Position"); labelPositionMenuItem.setToolTipText("Vertex Label Position"); toolMenuItem.add(labelPositionMenuItem); labelPositionMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { labelPositionMenuItemActionPerformed(evt); } }); final ScalingControl scaler = new CrossoverScalingControl(); zoominMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK)); zoominMenuItem.setText("Zoom-In"); zoominMenuItem.setToolTipText("Zoom-In"); toolMenuItem.add(zoominMenuItem); zoominMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); zoomoutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK)); zoomoutMenuItem.setText("Zoom-Out"); zoomoutMenuItem.setToolTipText("Zoom-Out"); toolMenuItem.add(zoomoutMenuItem); zoomoutMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { scaler.scale(vv, 0.9f, vv.getCenter()); } }); findNodeMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK)); findNodeMenuItem.setText("Find Node on Overlay"); findNodeMenuItem.setToolTipText("Find Node"); toolMenuItem.add(findNodeMenuItem); findNodeMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { findNodeMenuItemMenuItemActionPerformed(evt); } }); menuBar.add(toolMenuItem); helpMenu.setText("Help"); helpMenu.setToolTipText("Help"); aboutMenuItem.setText("About"); aboutMenuItem.setToolTipText("About"); aboutMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { aboutMenuItemActionPerformed(evt); } }); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); displayPanel.setLayout(new BorderLayout()); displayPanel.setBorder(new TitledBorder("P2P Overlay")); displayPanel.add(vv); validate(); // // nodeTextArea // nodeTextArea.setEditable(false); nodeTextArea.setLineWrap(true); // // jScrollPane1 // jScrollPane1.setViewportView(nodeTextArea); //jScrollPane1.setsi // // nodePanel // nodePanel.setLayout(new BoxLayout(nodePanel, BoxLayout.X_AXIS)); nodePanel.add(jScrollPane1, 0); nodePanel.setBorder(new TitledBorder("Nodes Active")); // // linkTextArea // linkTextArea.setEditable(false); linkTextArea.setLineWrap(true); // // jScrollPane3 // jScrollPane3.setViewportView(linkTextArea); // // linkPanel // linkPanel.setLayout(new BoxLayout(linkPanel, BoxLayout.X_AXIS)); linkPanel.add(jScrollPane3, 0); linkPanel.setBorder(new TitledBorder("Node Links")); // // consoleTextArea // consoleTextArea.setEditable(false); consoleTextArea.setLineWrap(true); // // jScrollPane2 // jScrollPane2.setViewportView(consoleTextArea); // // clearButton // clearButton.setText("Clear"); clearButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { clearButton_actionPerformed(e); } }); // // consolePanel // consolePanel.setLayout(new BoxLayout(consolePanel, BoxLayout.X_AXIS)); consolePanel.add(jScrollPane2, 0); consolePanel.add(clearButton, 1); consolePanel.setBorder(new TitledBorder("Console")); // // ServerGUI // Dimension panelD = new Dimension(700, 330); // display Panel Dimension panelD1 = new Dimension(700, 134); // control Panel Dimension panelD2 = new Dimension(350, 140); // nodepanel and linkpanel Dimension panelD3 = new Dimension(700, 140); // nodepanel and linkpanel togther consolePanel.setPreferredSize(panelD1); displayPanel.setPreferredSize(panelD); nodePanel.setPreferredSize(panelD2); linkPanel.setPreferredSize(panelD2); Box box = new Box(BoxLayout.X_AXIS); // put nodepanel and linkpanel in one box box.add(nodePanel); box.add(linkPanel); box.setSize(panelD3); //contentPane.add(BorderLayout.NORTH,displayPanel); //contentPane.add(BorderLayout.CENTER,box); contentPane.add(BorderLayout.NORTH, box); contentPane.add(BorderLayout.CENTER, displayPanel); contentPane.add(BorderLayout.SOUTH, consolePanel); frame.setJMenuBar(menuBar); frame.getContentPane().add(contentPane); frame.setTitle("P2P Visualisation Server"); frame.setSize(new Dimension(800, 600)); frame.setResizable(true); // This code has been adapted from http://lookass.ch/?id=4&area=art&art=47 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = frame.getSize(); screenSize.height = screenSize.height / 2; screenSize.width = screenSize.width / 2; size.height = size.height / 2; size.width = size.width / 2; int y = screenSize.height - size.height; int x = screenSize.width - size.width; frame.setLocation(x, y); frame.setVisible(true); frame.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); }
From source file:uk.co.modularaudio.componentdesigner.ComponentDesigner.java
public void registerCloseAction() throws DatastoreException { mainFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new WindowListener() { @Override/*from w ww.j a va2s. c o m*/ public void windowClosed(final WindowEvent e) { log.debug("Window closed event received"); } @Override public void windowOpened(final WindowEvent e) { try { log.debug("Window opening event received - setting thread to lowest priority."); ThreadUtils.setCurrentThreadPriority(MAThreadPriority.APPLICATION); if (log.isDebugEnabled()) { log.debug("Now set to " + MAThreadPriority.APPLICATION); } } catch (final Exception ie) { final String msg = "Exception caught setting gui thread priority: " + ie.toString(); log.error(msg, ie); } } @Override public void windowClosing(final WindowEvent e) { log.debug("Window closing event received."); final Action exitAction = mainFrameActions.getExitAction(); final ActionEvent exitActionEvent = new ActionEvent(e.getSource(), e.getID(), ""); exitAction.actionPerformed(exitActionEvent); } @Override public void windowIconified(final WindowEvent e) { } @Override public void windowDeiconified(final WindowEvent e) { } @Override public void windowActivated(final WindowEvent e) { } @Override public void windowDeactivated(final WindowEvent e) { } }); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Constructs a Basic Query instance/*from w ww .j a v a2 s . c o m*/ * * @param wantGUI * If true, the GUI is presented. */ public BasicQuery(boolean wantGUI) { super(); setupLogger(); setupLanguage(); if (wantGUI) { addWindowListener(this); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("BasicQuery"); setIconImage(new ImageIcon(ImageUtility.getImageAsByteArray("BasicQueryLogo32x32.gif")).getImage()); setup(); checkForNewVersion(); } }
From source file:utybo.branchingstorytree.swing.OpenBSTGUI.java
public OpenBSTGUI() { instance = this; UIManager.put("OptionPane.errorIcon", new ImageIcon(Icons.getImage("Cancel", 48))); UIManager.put("OptionPane.informationIcon", new ImageIcon(Icons.getImage("About", 48))); UIManager.put("OptionPane.questionIcon", new ImageIcon(Icons.getImage("Rename", 48))); UIManager.put("OptionPane.warningIcon", new ImageIcon(Icons.getImage("Error", 48))); BorderLayout borderLayout = new BorderLayout(); borderLayout.setVgap(4);//from w ww .ja v a2s. c om getContentPane().setLayout(borderLayout); setIconImage(Icons.getImage("Logo", 48)); setTitle("OpenBST " + OpenBST.VERSION); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { boolean cancelled = false; int i = 0; for (Component c : container.getComponents()) { if (c instanceof StoryPanel) { i++; } else if (c instanceof StoryEditor) { container.setSelectedComponent(c); if (((StoryEditor) c).askClose()) { continue; } else { cancelled = true; break; } } } if (!cancelled) { if (i > 0) { int j = Messagers.showConfirm(OpenBSTGUI.this, "You are about to close " + i + " file(s). Are you sure you wish to exit OpenBST?", Messagers.OPTIONS_YES_NO, Messagers.TYPE_WARNING, "Closing OpenBST"); if (j != Messagers.OPTION_YES) cancelled = true; } if (!cancelled) System.exit(0); } } }); JMenuBar jmb = new JMenuBar(); jmb.setBackground(OPENBST_BLUE); jmb.add(Box.createHorizontalGlue()); jmb.add(createShortMenu()); jmb.add(Box.createHorizontalGlue()); this.setJMenuBar(jmb); addDarkModeCallback(b -> { jmb.setBackground(b ? OPENBST_BLUE.darker().darker() : OPENBST_BLUE); }); container = new JTabbedPane(); container.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); container.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { if (SwingUtilities.isMiddleMouseButton(e)) { final int i = container.indexAtLocation(e.getX(), e.getY()); System.out.println(i); if (i > -1) { Component c = container.getComponentAt(i); if (c instanceof StoryPanel) { container.setSelectedComponent(c); ((StoryPanel) c).askClose(); } else if (c instanceof StoryEditor) { container.setSelectedComponent(c); ((StoryEditor) c).askClose(); } } } } }); getContentPane().add(container, BorderLayout.CENTER); final JBackgroundPanel welcomeContentPanel = new JBackgroundPanel(Icons.getRandomBackground(), Image.SCALE_FAST); background = welcomeContentPanel; welcomeContentPanel.setLayout(new MigLayout("hidemode 2", "[grow,center]", "[][grow][]")); container.add(welcomeContentPanel); container.setTitleAt(0, Lang.get("welcome")); bannersPanel = new JPanel(new MigLayout("hidemode 2, gap 0px, fill, wrap 1, ins 0")); bannersPanel.setBackground(new Color(0, 0, 0, 0)); welcomeContentPanel.add(bannersPanel, "cell 0 0,grow"); if (OpenBST.VERSION.endsWith("u")) { JButton btnReportBugs = new JButton(Lang.get("welcome.reportbugs")); btnReportBugs.addActionListener(e -> { VisualsUtils.browse("https://github.com/utybo/BST/issues"); }); bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Experiment", 32)), Color.YELLOW, Lang.get("welcome.ontheedge"), btnReportBugs, false), "grow"); } else if (OpenBST.VERSION.contains("SNAPSHOT")) { bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Experiment", 32)), Color.ORANGE, Lang.get("welcome.snapshot"), null, false), "grow"); } if (System.getProperty("java.specification.version").equals("9")) { bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Attention", 32)), new Color(255, 50, 50), Lang.get("welcome.java9warning"), null, false), "grow"); } if (System.getProperty("java.specification.version").equals("10")) { bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Attention", 32)), new Color(255, 50, 50), Lang.get("welcome.java10warning"), null, false), "grow"); } JButton btnJoinDiscord = new JButton(Lang.get("openbst.discordjoin")); btnJoinDiscord.addActionListener(e -> { VisualsUtils.browse("https://discord.gg/6SVDCMM"); }); bannersPanel.add(new JBannerPanel(new ImageIcon(Icons.getImage("Discord", 48)), DISCORD_COLOR, Lang.get("openbst.discord"), btnJoinDiscord, true), "grow"); JPanel panel = new JPanel(); panel.setBackground(new Color(0, 0, 0, 0)); welcomeContentPanel.add(panel, "flowx,cell 0 1,growx,aligny center"); panel.setLayout(new MigLayout("", "[40%][][][][60%,growprio 50]", "[][grow]")); final JLabel lblOpenbst = new JLabel(new ImageIcon(Icons.getImage("FullLogo", 48))); addDarkModeCallback(b -> lblOpenbst .setIcon(new ImageIcon(b ? Icons.getImage("FullLogoWhite", 48) : Icons.getImage("FullLogo", 48)))); panel.add(lblOpenbst, "flowx,cell 0 0 1 2,alignx trailing,aligny center"); JSeparator separator = new JSeparator(); separator.setOrientation(SwingConstants.VERTICAL); panel.add(separator, "cell 2 0 1 2,growy"); final JLabel lblWelcomeToOpenbst = new JLabel("<html>" + Lang.get("welcome.intro")); lblWelcomeToOpenbst.setMaximumSize(new Dimension(350, 999999)); panel.add(lblWelcomeToOpenbst, "cell 4 0"); Component horizontalStrut = Box.createHorizontalStrut(10); panel.add(horizontalStrut, "cell 1 1"); Component horizontalStrut_1 = Box.createHorizontalStrut(10); panel.add(horizontalStrut_1, "cell 3 1"); final JButton btnOpenAFile = new JButton(Lang.get("welcome.open")); panel.add(btnOpenAFile, "flowx,cell 4 1"); btnOpenAFile.setIcon(new ImageIcon(Icons.getImage("Open", 40))); btnOpenAFile.addActionListener(e -> { openStory(VisualsUtils.askForFile(this, Lang.get("file.title"))); }); final JButton btnOpenEditor = new JButton(Lang.get("welcome.openeditor")); panel.add(btnOpenEditor, "cell 4 1"); btnOpenEditor.setIcon(new ImageIcon(Icons.getImage("Edit Property", 40))); btnOpenEditor.addActionListener(e -> { openEditor(VisualsUtils.askForFile(this, Lang.get("file.title"))); }); JButton btnChangeBackground = new JButton(Lang.get("welcome.changebackground"), new ImageIcon(Icons.getImage("Change Theme", 16))); btnChangeBackground.addActionListener(e -> { BufferedImage prev = background.getImage(); BufferedImage next; do { next = Icons.getRandomBackground(); } while (prev == next); background.setImage(next); }); welcomeContentPanel.add(btnChangeBackground, "flowx,cell 0 2,alignx left"); JButton btnWelcomepixabay = new JButton(Lang.get("welcome.pixabay"), new ImageIcon(Icons.getImage("External Link", 16))); btnWelcomepixabay.addActionListener(e -> { VisualsUtils.browse("https://pixabay.com"); }); welcomeContentPanel.add(btnWelcomepixabay, "cell 0 2"); JLabel creds = new JLabel(Lang.get("welcome.credits")); creds.setEnabled(false); welcomeContentPanel.add(creds, "cell 0 2, gapbefore 10px"); setSize((int) (830 * Icons.getScale()), (int) (480 * Icons.getScale())); setLocationRelativeTo(null); }
From source file:xapps.browser.gsea.GseaFijiTabsApplicationFrame.java
/** * Class constructor/*from w w w . j a va 2 s. com*/ * * @throws HeadlessException */ public GseaFijiTabsApplicationFrame() { super(USER_VISIBLE_FRAME_TITLE); fFrame.setVisible(false); fFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // we catch and ask fFrame.setIconImage(ICON); // add a window listener to do clear up when windows closing. fWindowListener = new WindowAdapter() { public void windowClosing(WindowEvent e) { exitApplication(e); } }; fFrame.addWindowListener(fWindowListener); // Set the profile key fFrame.getDockingManager().setProfileKey(PROFILE_NAME); // Uses light-weight outline. There are several options here. fFrame.getDockingManager().setOutlineMode(DockingManager.PARTIAL_OUTLINE_MODE); // Now let's start to addFrame() fFrame.getDockingManager().beginLoadLayoutData(); fFrame.getDockingManager().setInitSplitPriority(DefaultDockingManager.SPLIT_SOUTH_NORTH_EAST_WEST); this.fWindowManager = new MyWindowManagerImplJideTabbedPane(); this.fStatusBar = new StatusBarJideImpl(); Application.registerHandler(this); // add menu bar fFrame.setJMenuBar(createMenuBar()); jbInit(); }
From source file:zsk.JFCMainClient.java
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event dispatch thread. *//*from w w w . j a v a 2 s. c o m*/ private static void initializeUI(boolean setVisibleFlg, String downloadDir) { String sv = "YTD2 ".concat(szVersion).concat(" ").concat("http://sourceforge.net/projects/ytd2/"); // ytd2.sf.net is shorter sv = isgerman() ? sv.replaceFirst("by", "von") : sv; if (!bIsCLI) { setDefaultLookAndFeelDecorated(false); frame = new JFCMainClient(sv); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addComponentsToPane(frame.getContentPane(), downloadDir); frame.pack(); frame.setVisible(setVisibleFlg); } else { setbSaveIDinFilename(true); } JFCMainClient.szDLSTATE = isgerman() ? "heruntergeladen " : JFCMainClient.szDLSTATE; sv = "version: ".concat(szVersion).concat(JFCMainClient.getbDEBUG() ? " DEBUG " : ""); sv = isgerman() ? sv.replaceFirst("by", "von") : sv; output(sv); debugoutput(sv); output(""); // \n // TODO ensure threads are running even if one ends with an (unhandled) Exception JFCMainClient.sproxy = System.getenv("http_proxy"); if (JFCMainClient.sproxy == null) sproxy = ""; sv = "HTTP Proxy: ".concat(sproxy); output(sv); debugoutput(sv); sv = isgerman() ? "Speicherverzeichnis: " : "initial download folder: "; if (bIsCLI) { if (config.getProperty("savefolder") == null) { // set initial download folder to users homedir String shomedir = System.getProperty("user.dir"); // for CLI-only run if (!shomedir.endsWith(System.getProperty("file.separator"))) shomedir += System.getProperty("file.separator"); config.setProperty("savefolder", shomedir); } sv = sv.concat((String) config.getProperty("savefolder")); } else { sv = sv.concat(JFCMainClient.frame.directorytextfield.getText()); config.setProperty("savefolder", JFCMainClient.frame.directorytextfield.getText()); } output(sv); debugoutput(sv); // lets respect the upload limit of google (youtube) // downloading is faster than viewing anyway so don't start more than six threads and don't play around with the URL-strings please!!! t1 = new YTDownloadThread(); t1.start(); t2 = new YTDownloadThread(); t2.start(); t3 = new YTDownloadThread(); t3.start(); t4 = new YTDownloadThread(); t4.start(); t5 = new YTDownloadThread(); t5.start(); t6 = new YTDownloadThread(); t6.start(); output(""); // \n output(isgerman() ? "besuche sf.net/projects/ytd2/forums fr irgendwelche Tipps, Vorschlge, Neuerungen, Fragen!" : "Visit sf.net/projects/ytd2/forums for tips, questions, updates and comments!"); output(""); // \n if (!bIsCLI) JFCMainClient.frame.cli("help"); }