com.jgoodies.looks.Options Java Examples

The following examples show how to use com.jgoodies.looks.Options. 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: MainFrame.java    From beast-mcmc with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static void createInstance() {
	try {
		Toolkit.getDefaultToolkit().setDynamicLayout(true);
		System.setProperty("sun.awt.noerasebackground","true");

		// JGoodies
		Options.setDefaultIconSize(new Dimension(16, 16));		// menu icons
		Options.setUseNarrowButtons(false);
		Options.setPopupDropShadowEnabled(true);

		UIManager.setLookAndFeel(System.getProperty("os.name").toLowerCase().startsWith("windows")
				? new WindowsLookAndFeel() : new PlasticXPLookAndFeel());

		_instance = new MainFrame();
	} catch (Exception e) {
		System.err.println(e);
	}
}
 
Example #2
Source File: MainFrame.java    From PyramidShader with GNU General Public License v3.0 6 votes vote down vote up
public static void createInstance() {
	try {
		Toolkit.getDefaultToolkit().setDynamicLayout(true);
		System.setProperty("sun.awt.noerasebackground","true");

		// JGoodies
		Options.setDefaultIconSize(new Dimension(16, 16));		// menu icons
		Options.setUseNarrowButtons(false);
		Options.setPopupDropShadowEnabled(true);

		UIManager.setLookAndFeel(System.getProperty("os.name").toLowerCase().startsWith("windows")
				? new WindowsLookAndFeel() : new PlasticXPLookAndFeel());

		_instance = new MainFrame();
	} catch (Exception e) {
		System.err.println(e);
	}
}
 
Example #3
Source File: Tiny.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Configures the UI; tries to set the system look on Mac, 
 * <code>WindowsLookAndFeel</code> on general Windows, and
 * <code>Plastic3DLookAndFeel</code> on Windows XP and all other OS.<p>
 * 
 * The JGoodies Swing Suite's <code>ApplicationStarter</code>,
 * <code>ExtUIManager</code>, and <code>LookChoiceStrategies</code>
 * classes provide a much more fine grained algorithm to choose and
 * restore a look and theme.
 */
private void configureUI() {
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    //Options.setGlobalFontSizeHints(FontSizeHints.MIXED);
    Options.setDefaultIconSize(new Dimension(18, 18));

    String lafName =
        LookUtils.IS_OS_WINDOWS_XP
            ? Options.getCrossPlatformLookAndFeelClassName()
            : Options.getSystemLookAndFeelClassName();

    try {
        UIManager.setLookAndFeel(lafName);
    } catch (Exception e) {
        System.err.println("Can't set look & feel:" + e);
    }
}
 
Example #4
Source File: Tiny.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Builds and answers the menu bar.
 */
private JMenuBar buildMenuBar() {
    JMenu menu;
    JMenuBar menuBar = new JMenuBar();
    menuBar.putClientProperty(Options.HEADER_STYLE_KEY, Boolean.TRUE);

    menu = new JMenu("File");
    menu.add(new JMenuItem("New..."));
    menu.add(new JMenuItem("Open..."));
    menu.add(new JMenuItem("Save"));
    menu.addSeparator();
    menu.add(new JMenuItem("Print..."));
    menuBar.add(menu);

    menu = new JMenu("Edit");
    menu.add(new JMenuItem("Cut"));
    menu.add(new JMenuItem("Copy"));
    menu.add(new JMenuItem("Paste"));
    menuBar.add(menu);

    return menuBar;
}
 
Example #5
Source File: MainFrame.java    From jmkvpropedit with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static void createInstance() {
	try {
		Toolkit.getDefaultToolkit().setDynamicLayout(true);
		System.setProperty("sun.awt.noerasebackground","true");

		// JGoodies
		Options.setDefaultIconSize(new Dimension(16, 16));		// menu icons
		Options.setUseNarrowButtons(false);
		Options.setPopupDropShadowEnabled(true);

		UIManager.setLookAndFeel(System.getProperty("os.name").toLowerCase().startsWith("windows")
				? new WindowsLookAndFeel() : new PlasticXPLookAndFeel());

		_instance = new MainFrame();
	} catch (Exception e) {
		System.err.println(e);
	}
}
 
Example #6
Source File: ChartLayoutPanel.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
private JToolBar createToolBar() {
    JToolBar toolBar = new JToolBar();
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    toolBar.setBorderPainted(false);
    
    dataSourcesComboBox = new JComboBox();
    dataSourcesComboBox.setPreferredSize(comboDim);
    dataSourcesComboBox.setMinimumSize(comboDim);
    dataSourcesComboBox.setMaximumSize(comboDim);
    dataSourcesComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            //must reset parameters values because for a different data source
            // we may have different values.
            RuntimeParametersPanel.resetParametersValues();
        }
    });
    
    toolBar.add(dataSourcesComboBox);
    toolBar.add(Box.createHorizontalStrut(5));
    
    toolBar.add(previewHTML5Action);
    toolBar.add(previewFlashAction);
    if (previewFlashAction.isSupported()) {
    	previewFlashAction.setEnabled(false);
    }        
    toolBar.add(previewImageAction);
    SwingUtil.addCustomSeparator(toolBar);
    toolBar.add(applyTemplateAction);
    toolBar.add(extractTemplateAction);
    return toolBar;
}
 
Example #7
Source File: MainToolBar.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
public MainToolBar() {
    putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    
    add(new NewQueryAction());
    add(saveAction);

    SwingUtil.addCustomSeparator(this);

    add(wizardAction);
    add(publishAction);
    
    SwingUtil.addCustomSeparator(this);

    add(new OpenQueryPerspectiveAction());        
    add(openLayoutPersAction = new OpenLayoutPerspectiveAction());
            
    Globals.setMainToolBar(this);
    newQueryActionUpdate();
    actionUpdate(Globals.getConnection() !=  null);
    enableLayoutPerspective(false);        
            
    SwingUtil.addCustomSeparator(this);        
    backAction = new BackToParentAction();
    backAction.setEnabled(false);
    add(backAction);        
    add(parent);
}
 
Example #8
Source File: MainMenuBar.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
public MainMenuBar() {
    putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    add(createFileMenu());        
    add(createViewsMenu());
    add(createToolsMenu());
    add(createHelpMenu());
    actionUpdate(Globals.getConnection() != null);
    Globals.setMainMenuBar(this);
}
 
Example #9
Source File: VisualisationToolBar.java    From chipster with MIT License 5 votes vote down vote up
public VisualisationToolBar() {

		super();

		this.setLayout(new MigLayout("alignx right, height 22!, insets 0"));
		this.setFloatable(false);
		this.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.SINGLE);

		methodChoiceBox.addActionListener(this);
		methodChoiceBox.setRenderer(new ComboBoxRenderer());

		String width = "width 100";
		
		this.add(methodChoiceBox, "width 200, pushx, aligny top");
		this.add(helpButton, width);
		this.add(maximiseButton, width);
		this.add(detachButton, width);
		this.add(closeButton, width);


		helpButton.addActionListener(this);
		maximiseButton.addActionListener(this);
		detachButton.addActionListener(this);
		closeButton.addActionListener(this);

		helpButton.setVisible(false);

		refreshVisualisationList(null, null);

		// start listening
		application.addClientEventListener(this);
	}
 
Example #10
Source File: VisualConstants.java    From chipster with MIT License 5 votes vote down vote up
public static UIDefaults getUIDefaults() {
	
	//Uncomment to see possible key values
	//listUIDefaults();
	
	UIDefaults defaults = new UIDefaults();

	// The defauls are specified for each look n feel and color theme
	if(UIManager.getLookAndFeel() instanceof Plastic3DLookAndFeel 
			&& Plastic3DLookAndFeel.getPlasticTheme() instanceof ExperienceBlue){
		
		BorderUIResource emptyBorder = new BorderUIResource(BorderFactory.createEmptyBorder());
		
		// Removes borders from menubar
		defaults.put("MenuBar.border", emptyBorder);
		
		defaults.put("SplitPaneDivider.border", emptyBorder);
		defaults.put("SplitPane.border", emptyBorder);
		defaults.put(Options.HEADER_STYLE_KEY, HeaderStyle.SINGLE);
		
		defaults.put("TaskPane.titleBackgroundGradientStart", 
				UIManager.getColor("Panel.background"));
		defaults.put("TaskPane.titleBackgroundGradientEnd", 
				UIManager.getColor("Panel.background"));
		defaults.put("TaskPaneContainer.background", Color.white);
		
		defaults.put("SimpleInternalFrame.activeTitleForeground", Color.white);
		
		
		// Adds textarea background to white. This affects for example 
		// help textarea on the top right corner and affymetrix wizard
		defaults.put("TextArea.background", Color.WHITE);    		
		
		TEXTAREA_UNEDITABLE_BACKGROUND = UIManager.getColor("Panel.background");
	} else {
		// There is no specified look and feel options for this LAF. Use defaults.
	}
	
	return defaults;
}
 
Example #11
Source File: Envisage.java    From attic-polygene-java with Apache License 2.0 4 votes vote down vote up
private void initLookAndFeel()
{
    String osName = System.getProperty( "os.name" ).toUpperCase();

    // set to use swing anti alias text only for JVM <= 1.5
    System.setProperty( "swing.aatext", "true" );

    // set default swing bold to false, only for JVM 1.5 or above
    UIManager.put( "swing.boldMetal", Boolean.FALSE );

    // set LaF
    LookAndFeel lnf = UIManager.getLookAndFeel();
    if( lnf != null && lnf.getID().equalsIgnoreCase( "Metal" ) )
    {
        final String lnfClassName;
        if( osName.startsWith( "MAC" ) )
        {
            System.setProperty( "com.apple.mrj.application.apple.menu.about.name", "Envisage" ); //TODO i18n
            System.setProperty( "apple.laf.useScreenMenuBar", "true" );
            lnfClassName = UIManager.getSystemLookAndFeelClassName();
        }
        else if( osName.startsWith( "WINDOWS" ) )
        {
            UIManager.put( "ClassLoader", LookUtils.class.getClassLoader() );
            lnfClassName = Options.getSystemLookAndFeelClassName();
            Options.setUseNarrowButtons( false );
        }
        else
        {
            UIManager.put( "ClassLoader", LookUtils.class.getClassLoader() );
            lnfClassName = Options.getCrossPlatformLookAndFeelClassName();
            PlasticLookAndFeel.setTabStyle( PlasticLookAndFeel.TAB_STYLE_METAL_VALUE );
            PlasticLookAndFeel.setPlasticTheme( new ExperienceBlue() );
            Options.setUseNarrowButtons( false );
            //PlasticLookAndFeel.setMyCurrentTheme(new ExperienceBlueDefaultFont());  // for CJK Font
        }

        if( lnfClassName != null )
        {
            try
            {
                UIManager.setLookAndFeel( lnfClassName );
            }
            catch( ClassNotFoundException | IllegalAccessException | InstantiationException |
                   UnsupportedLookAndFeelException ex )
            {
                System.err.println( "Unable to set LookAndFeel, use default LookAndFeel.\n" + ex.getMessage() );
            }
        }
    }
}
 
Example #12
Source File: MainFrame.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
        Globals.setMainFrame(this);

        // better text visualization for disabled components
    	Options.setPopupDropShadowEnabled(true); // add drop shadow to popup menu
        UIDefaults uiDefaults = UIManager.getDefaults();
        uiDefaults.put("ComboBox.disabledForeground", Color.DARK_GRAY);
        uiDefaults.put("TextField.inactiveForeground", Color.DARK_GRAY);
        uiDefaults.put("TextArea.inactiveBackground", Color.WHITE);
        uiDefaults.put("FormattedTextField.inactiveForeground",Color.DARK_GRAY);
        uiDefaults.put("PasswordField.inactiveForeground",Color.DARK_GRAY);
        uiDefaults.put("CheckBox.disabledText", Color.DARK_GRAY);

        // internationalization
        UIManager.put("OptionPane.yesButtonText", I18NSupport.getString("optionpanel.yes"));
        UIManager.put("OptionPane.cancelButtonText", I18NSupport.getString("optionpanel.cancel"));
        UIManager.put("OptionPane.noButtonText", I18NSupport.getString("optionpanel.no"));
        UIManager.put("OptionPane.okButtonText", I18NSupport.getString("optionpanel.ok"));
        UIManager.put("OptionPane.messageDialogTitle", I18NSupport.getString("optionpanel.message"));
        UIManager.put("ColorChooser.okText", I18NSupport.getString("colorchooser.ok"));
        UIManager.put("ColorChooser.cancelText", I18NSupport.getString("colorchooser.cancel"));
        UIManager.put("ColorChooser.resetText", I18NSupport.getString("colorchooser.reset"));
        UIManager.put("FileChooser.saveInLabelText", I18NSupport.getString("FileChooser.saveInLabelText"));
        UIManager.put("FileChooser.fileNameLabelText", I18NSupport.getString("FileChooser.fileNameLabelText"));
        UIManager.put("FileChooser.folderNameLabelText", I18NSupport.getString("FileChooser.folderNameLabelText"));
        UIManager.put("FileChooser.filesOfTypeLabelText", I18NSupport.getString("FileChooser.filesOfTypeLabelText"));
        UIManager.put("FileChooser.saveButtonText", I18NSupport.getString("FileChooser.saveButtonText"));
        UIManager.put("FileChooser.cancelButtonText", I18NSupport.getString("FileChooser.cancelButtonText"));
        UIManager.put("FileChooser.saveButtonToolTipText", I18NSupport.getString("FileChooser.saveButtonToolTipText"));
        UIManager.put("FileChooser.cancelButtonToolTipText", I18NSupport.getString("FileChooser.cancelButtonToolTipText"));
        UIManager.put("FileChooser.upFolderToolTipText", I18NSupport.getString("FileChooser.upFolderToolTipText"));
        UIManager.put("FileChooser.homeFolderToolTipText", I18NSupport.getString("FileChooser.homeFolderToolTipText"));
        UIManager.put("FileChooser.newFolderToolTipText", I18NSupport.getString("FileChooser.newFolderToolTipText"));
        UIManager.put("FileChooser.listViewButtonToolTipText", I18NSupport.getString("FileChooser.listViewButtonToolTipText"));
        UIManager.put("FileChooser.detailsViewButtonToolTipText", I18NSupport.getString("FileChooser.detailsViewButtonToolTipText"));

        // docking
        UIManager.put(MyDoggyKeySpace.DRAG_ENABLED, false); 
        
        // inside connections dir are kept the queries/reports for every data source
        DefaultDataSourceManager.getInstance().load();
        File  connections = new File(FileReportPersistence.CONNECTIONS_DIR);
        if (!connections.exists()) {
            connections.mkdir();
        }
        // inside reports dir are kept the generated reports
        File reports = new File(ExportAction.REPORTS_DIR);
        if (!reports.exists()) {
            reports.mkdir();
        }

        // create workspace panel
        workspacePanel = new JXPanel(new CardLayout());
        
        // create query builder panel before menu(!!! for docking)
        qbPanel = new QueryBuilderPanel();
        qbPanel.initWorkspace();

        setLayout(new BorderLayout());
//        add(new MainToolBar(), BorderLayout.NORTH);
        setToolBar(new MainToolBar());

        statusBar = new JXStatusBar();
        //statusBar.add(new JXLabel(""), JXStatusBar.Constraint.ResizeBehavior.FILL);
        statusBar.add(new JXLabel(""), new JXStatusBar.Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL, new Insets(0,5,2,2)));        
        statusBar.add(new MemoryStatus());
        statusBar.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));                
        setStatusBar(statusBar);

        WorkspaceManager workspaceManager = WorkspaceManager.getInstance();
        workspacePanel.add((Component) workspaceManager.getQueryWorkspace().getToolWindowManager(), WorkspaceManager.QUERY_WORKSPACE);
        workspacePanel.add((Component) workspaceManager.getReportWorkspace().getToolWindowManager(), WorkspaceManager.REPORT_WORKSPACE);
        workspacePanel.add((Component) workspaceManager.getChartWorkspace().getToolWindowManager(), WorkspaceManager.CHART_WORKSPACE);
        add(workspacePanel, BorderLayout.CENTER);
        
        DataSource ds = DefaultDataSourceManager.getInstance().getConnectedDataSource();
        if (ds != null) {
            setStatusBarMessage("<html>" + I18NSupport.getString("datasource.active") + 
            		" <b>" + ds.getName() + "</b></html>");
        }

        setJMenuBar(new MainMenuBar());

        Globals.getMainMenuBar().actionUpdate(ds != null);
        Globals.getMainToolBar().actionUpdate(ds != null);
        
        String systemReport = Globals.getSystemReport();
        String systemChart = Globals.getSystemChart();
        String systemPath = Globals.getSystemPath();
        if (systemReport !=  null) {
        	openSystemReport(systemReport, systemPath);
        } else if (systemChart !=  null) {
        	openSystemChart(systemChart, systemPath);
        }
        
    }