List of usage examples for java.awt Frame MAXIMIZED_BOTH
int MAXIMIZED_BOTH
To view the source code for java.awt Frame MAXIMIZED_BOTH.
Click Source Link
From source file:events.WindowEventDemo.java
private String convertStateToString(int state) { if (state == Frame.NORMAL) { return "NORMAL"; }//from w w w .java 2 s . c o m String strState = " "; if ((state & Frame.ICONIFIED) != 0) { strState += "ICONIFIED"; } //MAXIMIZED_BOTH is a concatenation of two bits, so //we need to test for an exact match. if ((state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) { strState += "MAXIMIZED_BOTH"; } else { if ((state & Frame.MAXIMIZED_VERT) != 0) { strState += "MAXIMIZED_VERT"; } if ((state & Frame.MAXIMIZED_HORIZ) != 0) { strState += "MAXIMIZED_HORIZ"; } } if (" ".equals(strState)) { strState = "UNKNOWN"; } return strState.trim(); }
From source file:WindowEventDemo.java
private String convertStateToString(int state) { if (state == Frame.NORMAL) { return "NORMAL"; }// w w w . j av a 2 s . com String strState = " "; if ((state & Frame.ICONIFIED) != 0) { strState += "ICONIFIED"; } // MAXIMIZED_BOTH is a concatenation of two bits, so // we need to test for an exact match. if ((state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) { strState += "MAXIMIZED_BOTH"; } else { if ((state & Frame.MAXIMIZED_VERT) != 0) { strState += "MAXIMIZED_VERT"; } if ((state & Frame.MAXIMIZED_HORIZ) != 0) { strState += "MAXIMIZED_HORIZ"; } } if (" ".equals(strState)) { strState = "UNKNOWN"; } return strState.trim(); }
From source file:GUI.Main.java
static void openListOfOffresFrame(final LoginE client) throws IOException { System.out.println("////////////////////////////////////////////////////////////////////////////////////"); System.out.println("////////////////////////////////////////////////////////////////////////////////////"); System.out.println("My ID :" + client.getId()); System.out.println("////////////////////////////////////////////////////////////////////////////////////"); System.out.println("////////////////////////////////////////////////////////////////////////////////////"); new SwingWorker<Void, Void>() { @Override//from ww w .jav a2 s . co m protected Void doInBackground() throws Exception { // do some processing here while the progress bar is running fm.setSize(500, 500); fm.setLocation(300, 200); fm.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); fm.setLayout(new GridLayout(1, 1, 5, 5)); try { fm1.add(createAdminPanel(client.getURLp(), client.getNom(), client.getPrenom(), client.getId())); } catch (IOException ex) { } return null; } // this is called when doInBackground finished @Override protected void done() { //Background processing done //Crate new Frale and confagurated fm.add(fm1); ListOfOffresFrame = new JFrame(); ListOfOffresFrame.setMaximizedBounds(null); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); ListOfOffresFrame.setMinimumSize(dim); ListOfOffresFrame.setTitle("T_IMMOB"); ListOfOffresFrame.setLayout(new GridLayout(1, 0)); ListOfOffresFrame.setLocation(0, 0); ListOfOffresFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); try { gfl = new ListOfOffres1().createListOfOffresPanel(0, "", client.getId()); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (JSONException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } gf2.add(new GroupPanel(GroupingType.fillLast, 0, true, fm, new WhiteSpace(), gfl)); ListOfOffresFrame.setContentPane(gf2); ListOfOffresFrame.setPreferredSize(dim); ListOfOffresFrame.setExtendedState(Frame.MAXIMIZED_BOTH); ListOfOffresFrame.setVisible(true); prog.setVisible(false); prog.dispose(); final WebPopOver popOver = new WebPopOver(textSearchField); popOver.setCloseOnFocusLoss(true); popOver.setMargin(10); popOver.setLayout(new VerticalFlowLayout()); popOver.add(new WebLabel( "<html><center><font size=4>Vous pouvez faire des recherche sure</font></center></html>")); popOver.add( new WebLabel("<html><center><font size=3>- Etat de l'offre ( Nouveau , Bon , Mauvais)")); popOver.add(new WebLabel( "<html><center><font size=3>- Nature de l'offre ( Location , Vente )</font></center></html>")); popOver.add(new WebLabel( "<html><center><font size=3>- Type de l'offre ( Vila , Studio , Apartemen ,</font></center></html>")); popOver.add(new WebLabel("<html><center><font size=3>Maison , Entrepot)</font></center></html>")); popOver.show(textSearchField); } } .execute(); }
From source file:ca.uhn.hl7v2.testpanel.ui.TestPanelWindow.java
private void initWindowPosition() { if (Prefs.getInstance().getWindowMaximized()) { myframe.setExtendedState(JFrame.MAXIMIZED_BOTH); return;/*from w ww . j av a 2s . c o m*/ } Rectangle screenBounds = ScreenBoundsUtil.getScreenBounds(myframe); int maxWidth = screenBounds.width; int maxHeight = screenBounds.height; int width; int height; Point position = Prefs.getInstance().getWindowPosition(); Dimension dimension = Prefs.getInstance().getWindowDimension(); if (dimension.width > 600 && dimension.height > 500) { if (position.x >= 0 && position.y >= 0) { if (dimension.width + position.x < maxWidth) { if (dimension.height + position.y < maxHeight) { ourLog.info("Restoring window size to {} and location to {}", dimension, position); myframe.setLocation(position); myframe.setSize(dimension); return; } } } } width = (int) (maxWidth * 0.7); if (width < 1024) { width = maxWidth; } width = Math.min(width, 1600); height = (int) (maxHeight * 0.7); if (height < 600) { height = maxHeight; } height = Math.min(height, 1000); if (width == maxWidth && height == maxHeight) { ourLog.info("Maximizing window"); myframe.setExtendedState(Frame.MAXIMIZED_BOTH); } else { ourLog.info("Setting window size to {} x {}", width, height); myframe.setSize(width, height); } myframe.setLocationByPlatform(true); }
From source file:net.sf.firemox.Magic.java
/** * Creates new form Magic/* w w w .j a v a2 s. c o m*/ */ private Magic() { super(); initComponents(); // list all installed Look&Feel UIListener uiListener = new UIListener(); UIManager.LookAndFeelInfo[] uimTMP = UIManager.getInstalledLookAndFeels(); final List<Pair<String, String>> lfList = new ArrayList<Pair<String, String>>(); for (LookAndFeelInfo lookAndFeel : uimTMP) { Pair<String, String> info = new Pair<String, String>(lookAndFeel.getName(), lookAndFeel.getClassName()); if (!lfList.contains(info)) { lfList.add(info); } } // list all SkinLF themes final File[] themes = MToolKit.getFile("lib").listFiles(new FileFilter() { public boolean accept(File f) { return f != null && f.getName().endsWith(".zip"); } }); int maxIndex = Configuration.getConfiguration().getMaxIndex("themes.skinlf.caches.cache"); List<Pair<String, String>> knownThemes = new ArrayList<Pair<String, String>>(); for (int i = 0; i < maxIndex + 1; i++) { String file = Configuration.getConfiguration() .getString("themes.skinlf.caches.cache(" + i + ").[@file]"); int index = ArrayUtils.indexOf(themes, MToolKit.getFile(file)); if (index >= 0) { themes[index] = null; Pair<String, String> skin = new Pair<String, String>( Configuration.getConfiguration().getString("themes.skinlf.caches.cache(" + i + ").[@name]"), file); knownThemes.add(skin); lfList.add(skin); } } for (File theme : themes) { if (theme != null) { // a new theme --> will be cached try { final List<Node> properties = new XmlParser().parse(new ZipResourceLoader(theme.toURI().toURL()) .getResourceAsStream("skinlf-themepack.xml")).getNodes("property"); PROPERTIES: for (int j = 0; j < properties.size(); j++) { if ("skin.name".equals(properties.get(j).getAttribute("name"))) { // skin name found String relativePath = MToolKit.getRelativePath(theme.getCanonicalPath()); Pair<String, String> skin = new Pair<String, String>( properties.get(j).getAttribute("value"), "zip:" + relativePath); lfList.add(skin); knownThemes.add(new Pair<String, String>(properties.get(j).getAttribute("value"), relativePath)); break PROPERTIES; } } } catch (Exception e) { Log.error("Error in " + theme, e); } } } Configuration.getConfiguration().clearProperty("themes.skinlf.caches"); for (int index = 0; index < knownThemes.size(); index++) { Pair<String, String> skin = knownThemes.get(index); Configuration.getConfiguration().setProperty("themes.skinlf.caches.cache(" + index + ").[@name]", skin.key); Configuration.getConfiguration().setProperty("themes.skinlf.caches.cache(" + index + ").[@file]", skin.value); } // create look and feel menu items Collections.sort(lfList); lookAndFeels = new JRadioButtonMenuItem[lfList.size() + 1]; ButtonGroup group5 = new ButtonGroup(); for (int i = 0; i < lfList.size(); i++) { final String lfName = lfList.get(i).key; final String lfClassName = lfList.get(i).value; lookAndFeels[i] = new JRadioButtonMenuItem(lfName); if (lookAndFeelName.equalsIgnoreCase(lfClassName)) { // this the current l&f lookAndFeels[i].setSelected(true); } if (!SkinLF.isSkinLF(lfClassName)) { lookAndFeels[i].setEnabled(MToolKit.isAvailableLookAndFeel(lfClassName)); } group5.add(lookAndFeels[i]); lookAndFeels[i].setActionCommand(lfClassName); themeMenu.add(lookAndFeels[i], i); lookAndFeels[i].addActionListener(uiListener); } lfList.clear(); initialdelayMenu.addActionListener(this); dismissdelayMenu.addActionListener(this); ConnectionManager.enableConnectingTools(false); // read auto mana option MCommonVars.autoMana = Configuration.getBoolean("automana", true); autoManaMenu.setSelected(MCommonVars.autoMana); // Force to initialize the TBS settings MToolKit.tbsName = null; setMdb(Configuration.getString("lastTBS", IdConst.TBS_DEFAULT)); // set the autoStack mode MCommonVars.autoStack = Configuration.getBoolean("autostack", false); autoPlayMenu.setSelected(MCommonVars.autoStack); // read maximum displayed colored mana in context PayMana.thresholdColored = Configuration.getInt("threshold-colored", 6); ZoneManager.updateLookAndFeel(); // pack this frame pack(); // Maximize this frame setExtendedState(Frame.MAXIMIZED_BOTH); if (batchMode != -1) { final String deckFile = Configuration.getString(Configuration.getString("decks.deck(0)")); try { Deck batchDeck = DeckReader.getDeck(this, deckFile); switch (batchMode) { case BATCH_SERVER: ConnectionManager.server = new Server(batchDeck, null); ConnectionManager.server.start(); break; case BATCH_CLIENT: ConnectionManager.client = new Client(batchDeck, null); ConnectionManager.client.start(); break; default: } } catch (Throwable e) { throw new RuntimeException("Error in batch mode : ", e); } } }
From source file:core.PlanC.java
public static void setContentPane(int p) { actualContent = p;//from w ww. j av a 2 s.com if (p == SIGNIN) { frame.setVisible(false); frame.setJMenuBar(null); frame.setResizable(false); actPane = new PUserLogIn(); JButton jb = (JButton) ((PUserLogIn) actPane).getClientProperty(TConstants.DEFAULT_BUTTON); frame.getRootPane().setDefaultButton(jb); // TODO: bug when user or sistem sign out the app, the dockein pane still inside the frame and cause a blink // error.temporaly use setcontentpane method // frame.setContent(actPane); frame.setContentPane(actPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); // backdoor for developers if (false) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { String us = TPreferences.getProperty(TPreferences.USER, "SLEPLANC"); Record r = (Record) ConnectionManager.getAccessTo("sle_users") .exist("username ='" + us + "'"); Session.setUser(r); } }); return; } } if (p == CONSOLE) { frame.setJMenuBar(null); frame.setResizable(false); actPane = new TTilePanel(); frame.setContentPane(actPane); frame.setBounds(frame.getSizeBy(.5)); frame.setLocationRelativeTo(null); frame.setVisible(true); } if (p == CHANGE_PASSWORD) { oldBound = frame.getBounds(); JButton jb = null; actPane = new PChangePassword(Session.getUser(), true); jb = (JButton) ((PChangePassword) actPane).getClientProperty(TConstants.DEFAULT_BUTTON); jb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Record r = ((PChangePassword) actPane).getRecord(); ConnectionManager.getAccessTo("sle_users").write(r); Session.setUser(r); } }); JButton ca = (JButton) ((PChangePassword) actPane).getClientProperty(TConstants.DEFAULT_CANCEL_BUTTON); ca.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Exit.shutdown(); } }); frame.getRootPane().setDefaultButton(jb); // frame.setContentPane(actPane); frame.setContent(actPane); frame.performTransition(oldBound); } if (p == DOCKING) { oldBound = frame.getBounds(); // TODO: temporal. bug when sign out action is performed frame.setContentPane(new JPanel()); // frame bound Rectangle sbound = (Rectangle) TPreferences.getPreference(TPreferences.WINDOW_BOUND, PlanC.class.getName(), frame.getSizeBy(0.7)); // frame state boolean ani = true; int sts = (Integer) TPreferences.getPreference(TPreferences.WINDOW_STATE, PlanC.class.getName(), JFrame.NORMAL); if ((sts & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) { ani = false; frame.setBounds(sbound); frame.setExtendedState(sts); } if (sts == JFrame.ICONIFIED) { frame.setBounds(sbound); frame.setState(JFrame.NORMAL); } frame.setResizable(true); frame.setContent(TUIUtils.getBackgroundPanel()); // perform animation if frame state allow it if (ani) { frame.performTransition1(oldBound, sbound); } } if (p == HELP) { frame.setJMenuBar(null); actPane = new HelpPlayer(); frame.setContentPane(actPane); frame.setResizable(false); frame.pack(); } }
From source file:org.geopublishing.atlasViewer.swing.AtlasViewerGUI.java
/** * This method initializes the main {@link AtlasViewerGUI} {@link JFrame}. * If an icon ({@link AtlasConfig.JWSICON_RESOURCE_NAME}) has been defined * for this atlas it will be set as the {@link JFrame} icon. *///from www. j a v a 2 s. co m public final JFrame getJFrame() { if (atlasJFrame == null) { // SwingUtil.checkOnEDT(); /** * Disabled, because Artuhr wants to make screenshots with Metal On * Windows we dare to set the LnF to Windows if * (GuiAndTools.getOSType() == OSfamiliy.windows) { try { * UIManager.setLookAndFeel(UIManager * .getSystemLookAndFeelClassName()); } catch (Exception e) { * LOGGER.warn("Couldn't set the Look&Feel to Windows native"); } } */ atlasJFrame = new JFrame(); if (getAtlasConfig().getIconURL() != null) { atlasJFrame.setIconImage(new ImageIcon(getAtlasConfig().getIconURL()).getImage()); } atlasJFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); atlasJFrame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { exitAV(0); } }); atlasJFrame.setJMenuBar(getAtlasMenuBar()); updateTitle(); atlasJFrame.setPreferredSize(new Dimension(800, 600)); atlasJFrame.pack(); SwingUtil.centerFrameOnScreen(atlasJFrame); int state = atlasJFrame.getExtendedState(); // Set the maximized bits state |= Frame.MAXIMIZED_BOTH; // Maximize the frame atlasJFrame.setExtendedState(state); atlasJFrame.setVisible(true); } return atlasJFrame; }
From source file:v800_trainer.JCicloTronic.java
/** Creates new form JCicloTronic */ public JCicloTronic() { ScreenSize = new Dimension(); SelectionChanged = false;/* w ww .j ava2 s . c o m*/ ScreenSize.setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth() - 50, java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 50); Size = new Dimension(); Properties = new java.util.Properties(); SystemProperties = java.lang.System.getProperties(); chooser = new javax.swing.JFileChooser(); RawData = new byte[98316]; // System.setProperty("jna.library.path" , "C:/WINDOWS/system32"); try { FileInputStream in = new FileInputStream(SystemProperties.getProperty("user.dir") + SystemProperties.getProperty("file.separator") + "JCicloexp.cfg"); Properties.load(in); in.close(); } catch (Exception e) { FontSize = 20; setFontSizeGlobal("Tahoma", FontSize); JOptionPane.showMessageDialog(null, "Keine Config-Datei in: " + SystemProperties.getProperty("user.dir"), "Achtung!", JOptionPane.ERROR_MESSAGE); Properties.put("working.dir", SystemProperties.getProperty("user.dir")); Eigenschaften = new Eigenschaften(new javax.swing.JFrame(), true, this); this.setExtendedState(Frame.MAXIMIZED_BOTH); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); double width = screenSize.getWidth(); double height = screenSize.getHeight(); this.setSize(new Dimension((int) width, (int) height)); this.setPreferredSize(new Dimension((int) width, (int) height)); this.setMinimumSize(new Dimension((int) width, (int) height)); repaint(); } try { UIManager.setLookAndFeel(Properties.getProperty("LookFeel")); SwingUtilities.updateComponentTreeUI(this); this.pack(); } catch (Exception exc) { } if (debug) { try { System.setErr(new java.io.PrintStream(new FileOutputStream(Properties.getProperty("working.dir") + SystemProperties.getProperty("file.separator") + "error.txt"))); // System.err = new FileOutputStream(Properties.getProperty("working.dir") + SystemProperties.getProperty("file.separator") + "error.txt"); System.setOut(new java.io.PrintStream(new FileOutputStream(Properties.getProperty("working.dir") + SystemProperties.getProperty("file.separator") + "error.txt"))); } catch (Exception err) { } } initComponents(); setTitle("V800 Trainer Datadir: " + Properties.getProperty("data.dir")); icon = new ImageIcon("hw.jpg"); setIconImage(icon.getImage()); if (Integer.parseInt(Properties.getProperty("View Geschw", "1")) == 1) { Graphik_check_Geschwindigkeit.setSelected(true); } else { Graphik_check_Geschwindigkeit.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Hhe", "1")) == 1) { Graphik_check_Hhe.setSelected(true); } else { Graphik_check_Hhe.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Hf", "1")) == 1) { Graphik_check_HF.setSelected(true); } else { Graphik_check_HF.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Temp", "1")) == 1) { Graphik_check_Temp.setSelected(true); } else { Graphik_check_Temp.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Steigp", "1")) == 1) { Graphik_check_Steigung_p.setSelected(true); } else { Graphik_check_Steigung_p.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Steigm", "1")) == 1) { Graphik_check_Steigung_m.setSelected(true); } else { Graphik_check_Steigung_m.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View av_Geschw", "1")) == 1) { Graphik_check_av_Geschw.setSelected(true); } else { Graphik_check_av_Geschw.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Cadence", "1")) == 1) { Graphik_check_Cadence.setSelected(true); } else { Graphik_check_Cadence.setSelected(false); } if (Integer.parseInt(Properties.getProperty("View Schrittlnge", "1")) == 1) { Graphik_check_Schrittlnge.setSelected(true); } else { Graphik_check_Schrittlnge.setSelected(false); } if (Integer.parseInt(Properties.getProperty("ZeitStreckeAbstnde", "1")) == 1) { Graphik_check_Abstand.setSelected(true); } else { Graphik_check_Abstand.setSelected(false); } if (Integer.parseInt(Properties.getProperty("SummenHisto", "1")) == 1) { Summenhistogramm_Check.setSelected(true); } else { Summenhistogramm_Check.setSelected(false); } if (Integer.parseInt(Properties.getProperty("xy_Strecke", "1")) == 1) { Graphik_Radio_Strecke.setSelected(true); Graphik_Radio_Zeit.setSelected(false); } else { Graphik_Radio_Strecke.setSelected(false); Graphik_Radio_Zeit.setSelected(true); } //Buttons fr XY-Darstellung (ber Strecke oder ber Zeit) X_Axis = new ButtonGroup(); X_Axis.add(Graphik_Radio_Strecke); X_Axis.add(Graphik_Radio_Zeit); //Buttons fr Jahresbersicht bersicht = new ButtonGroup(); bersicht.add(jRadioButton_jahresverlauf); bersicht.add(jRadioButton_monatsbersicht); Datenliste_Zeitabschnitt.addItem("nicht aktiv"); Datenliste_Zeitabschnitt.addItem("vergangene Woche"); Datenliste_Zeitabschnitt.addItem("vergangener Monat"); Datenliste_Zeitabschnitt.addItem("vergangenes Jahr"); Datenliste_Zeitabschnitt.addItem("Alles"); if (Datentabelle.getRowCount() != 0) { Datentabelle.addRowSelectionInterval(0, 0); Datenliste_scroll_Panel.getViewport().setViewPosition(new java.awt.Point(0, 0)); } // if (Properties.getProperty("CommPort").equals("nocom")) { // jMenuReceive.setEnabled(false); // } else { // jMenuReceive.setEnabled(true); // } jLabel69_Selektiert.setText(Datentabelle.getSelectedRowCount() + " / " + Datentabelle.getRowCount()); setFileChooserFont(chooser.getComponents()); locmap = true; Map_Type.removeAllItems(); Map_Type.addItem("OpenStreetMap"); Map_Type.addItem("Virtual Earth Map"); Map_Type.addItem("Virtual Earth Satelite"); Map_Type.addItem("Virtual Earth Hybrid"); locmap = false; // ChangeModel(); }
From source file:org.yccheok.jstock.gui.JStock.java
/** * Initialize this MainFrame based on the JStockOptions. *///from w w w . j a v a 2 s . c om private void init() { initComponents(); createLookAndFeelMenuItems(); createCountryMenuItems(); createStockIndicatorEditor(); createIndicatorScannerJPanel(); createPortfolioManagementJPanel(); createIconsAndToolTipTextForJTabbedPane(); this.createSystemTrayIcon(); this.initPreloadDatabase(false); this.initExtraDatas(); this.initStatusBar(); this.initMarketJPanel(); this.initTableHeaderToolTips(); this.initMyJXStatusBarExchangeRateLabelMouseAdapter(); this.initMyJXStatusBarCountryLabelMouseAdapter(); this.initMyJXStatusBarImageLabelMouseAdapter(); this.initStockInfoDatabaseMeta(); this.initDatabase(true); this.initAjaxProvider(); this.initRealTimeIndexMonitor(); this.initLatestNewsTask(); this.initExchangeRateMonitor(); this.initRealTimeStockMonitor(); this.initWatchlist(); this.initAlertStateManager(); this.initDynamicCharts(); this.initDynamicChartVisibility(); this.initAlwaysOnTop(); this.initStockHistoryMonitor(); this.initOthersStockHistoryMonitor(); this.initGUIOptions(); this.initChartJDialogOptions(); this.initLanguageMenuItemsSelection(); this.initJXLayerOnJComboBox(); this.initKeyBindings(); // Turn to the last viewed page. final int lastSelectedPageIndex = this.getJStockOptions().getLastSelectedPageIndex(); if (this.jTabbedPane1.getTabCount() > lastSelectedPageIndex) { this.jTabbedPane1.setSelectedIndex(lastSelectedPageIndex); } // setSelectedIndex will not always trigger jTabbedPane1StateChanged, // if the selected index is same as current page index. However, we are // expecting jTabbedPane1StateChanged to suspend/resume // PortfolioManagementJPanel's RealtTimeStockMonitor and MainFrame's // CurrencyExchangeMonitor, in order to preserve network resource. Hence, // we need to call handleJTabbedPaneStateChanged explicitly. handleJTabbedPaneStateChanged(this.jTabbedPane1); // Restore previous size and location. JStockOptions.BoundsEx boundsEx = jStockOptions.getBoundsEx(); if (boundsEx == null) { // First time. Maximize it. this.setExtendedState(Frame.MAXIMIZED_BOTH); } else { if ((boundsEx.extendedState & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) { this.setExtendedState(Frame.MAXIMIZED_BOTH); } else { this.setBounds(boundsEx.bounds); } } installShutdownHook(); // Spain no longer supported. Sad... if (this.jStockOptions.getCountry() == Country.Spain) { JOptionPane.showMessageDialog(null, MessagesBundle.getString("info_message_spain_not_supported"), MessagesBundle.getString("info_title_spain_not_supported"), JOptionPane.INFORMATION_MESSAGE); } }
From source file:org.yccheok.jstock.gui.MainFrame.java
/** * Initialize this MainFrame based on the JStockOptions. *///from ww w .ja va2s. com private void init() { try { UIManager.setLookAndFeel(getJStockOptions().getLooknFeel()); } catch (java.lang.ClassNotFoundException exp) { log.error(null, exp); } catch (java.lang.InstantiationException exp) { log.error(null, exp); } catch (java.lang.IllegalAccessException exp) { log.error(null, exp); } catch (javax.swing.UnsupportedLookAndFeelException exp) { log.error(null, exp); } initComponents(); createLookAndFeelMenuItem(); createCountryMenuItem(); createStockIndicatorEditor(); createIndicatorScannerJPanel(); createPortfolioManagementJPanel(); createIconsAndToolTipTextForJTabbedPane(); this.createSystemTrayIcon(); this.initPreloadDatabase(false); this.initExtraDatas(); this.initStatusBar(); this.initMarketJPanel(); this.initTableHeaderToolTips(); this.initMyJXStatusBarExchangeRateLabelMouseAdapter(); this.initMyJXStatusBarCountryLabelMouseAdapter(); this.initMyJXStatusBarImageLabelMouseAdapter(); this.initStockInfoDatabaseMeta(); this.initDatabase(true); this.initAjaxProvider(); this.initMarketThread(); this.initLatestNewsTask(); this.initKLSEInfoStockServerFactoryThread(); this.initCurrencyExchangeMonitor(); this.initRealTimeStockMonitor(); this.initWatchlist(); this.initAlertStateManager(); this.initDynamicCharts(); this.initDynamicChartVisibility(); this.initStockHistoryMonitor(); this.initOthersStockHistoryMonitor(); this.initBrokingFirmLogos(); this.initGUIOptions(); this.initChartJDialogOptions(); this.initLanguageMenuItemsSelection(); this.initJXLayerOnJComboBox(); this.initKeyBindings(); // Turn to the last viewed page. final int lastSelectedPageIndex = this.getJStockOptions().getLastSelectedPageIndex(); if (this.jTabbedPane1.getTabCount() > lastSelectedPageIndex) { this.jTabbedPane1.setSelectedIndex(lastSelectedPageIndex); } // setSelectedIndex will not always trigger jTabbedPane1StateChanged, // if the selected index is same as current page index. However, we are // expecting jTabbedPane1StateChanged to suspend/resume // PortfolioManagementJPanel's RealtTimeStockMonitor and MainFrame's // CurrencyExchangeMonitor, in order to preserve network resource. Hence, // we need to call handleJTabbedPaneStateChanged explicitly. handleJTabbedPaneStateChanged(this.jTabbedPane1); // Restore previous size and location. JStockOptions.BoundsEx boundsEx = jStockOptions.getBoundsEx(); if (boundsEx == null) { // First time. Maximize it. this.setExtendedState(Frame.MAXIMIZED_BOTH); } else { if ((boundsEx.extendedState & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) { this.setExtendedState(Frame.MAXIMIZED_BOTH); } else { this.setBounds(boundsEx.bounds); } } installShutdownHook(); // Spain no longer supported. Sad... if (this.jStockOptions.getCountry() == Country.Spain) { JOptionPane.showMessageDialog(null, MessagesBundle.getString("info_message_spain_not_supported"), MessagesBundle.getString("info_title_spain_not_supported"), JOptionPane.INFORMATION_MESSAGE); } }