private void updateStyle(JSplitPane splitPane) { SynthContext context = getContext(splitPane, Region.SPLIT_PANE_DIVIDER, ENABLED); SynthStyle oldDividerStyle = dividerStyle; dividerStyle = SynthLookAndFeel.updateStyle(context, this); context.dispose(); context = getContext(splitPane, ENABLED); SynthStyle oldStyle = style; style = SynthLookAndFeel.updateStyle(context, this); if (style != oldStyle) { Object value = style.get(context, "SplitPane.size"); if (value == null) { value = Integer.valueOf(6); } LookAndFeel.installProperty(splitPane, "dividerSize", value); value = style.get(context, "SplitPane.oneTouchExpandable"); if (value != null) { LookAndFeel.installProperty(splitPane, "oneTouchExpandable", value); } if (divider != null) { splitPane.remove(divider); divider.setDividerSize(splitPane.getDividerSize()); } if (oldStyle != null) { uninstallKeyboardActions(); installKeyboardActions(); } } if (style != oldStyle || dividerStyle != oldDividerStyle) { // Only way to force BasicSplitPaneDivider to reread the // necessary properties. if (divider != null) { splitPane.remove(divider); } divider = createDefaultDivider(); divider.setBasicSplitPaneUI(this); splitPane.add(divider, JSplitPane.DIVIDER); } context.dispose(); }
/** * Tests out the GUIChooser environment. * * @param args ignored. */ public static void main(String[] args) { LookAndFeel.setLookAndFeel(); try { // uncomment to disable the memory management: // m_Memory.setEnabled(false); m_chooser = new GUIChooser(); m_chooser.setVisible(true); Thread memMonitor = new Thread() { public void run() { while (true) { try { // System.out.println("before sleeping"); this.sleep(4000); System.gc(); if (m_Memory.isOutOfMemory()) { // clean up m_chooser.dispose(); if (m_chooser.m_ExperimenterFrame != null) { m_chooser.m_ExperimenterFrame.dispose(); m_chooser.m_ExperimenterFrame = null; } if (m_chooser.m_ExplorerFrame != null) { m_chooser.m_ExplorerFrame.dispose(); m_chooser.m_ExplorerFrame = null; } if (m_chooser.m_KnowledgeFlowFrame != null) { m_chooser.m_KnowledgeFlowFrame.dispose(); m_chooser.m_KnowledgeFlowFrame = null; } if (m_chooser.m_SimpleCLI != null) { m_chooser.m_SimpleCLI.dispose(); m_chooser.m_SimpleCLI = null; } m_chooser = null; System.gc(); // stop threads m_Memory.stopThreads(); // display error System.err.println("\ndisplayed message:"); m_Memory.showOutOfMemory(); System.err.println("\nexiting..."); System.exit(-1); } } catch (InterruptedException ex) { ex.printStackTrace(); } } } }; memMonitor.setPriority(Thread.NORM_PRIORITY); memMonitor.start(); } catch (Exception ex) { ex.printStackTrace(); System.err.println(ex.getMessage()); } }