Java Code Examples for javax.swing.UIManager

The following are top voted examples for showing how to use javax.swing.UIManager. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: HiDPIPropertiesUnixTest.java   Source Code and License 8 votes vote down vote up
public static void main(String[] args) throws Exception {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        String testCase = args[0];
        switch (testCase) {
            case "UISCALE_DISABLED":
                testScale(1.0, 1.0);
                break;
            case "UISCALE_3":
                testScale(3.0, 3.0);
                break;
            case "UISCALE_4":
                testScale(4.0, 4.0);
                break;
            default:
                throw new RuntimeException("Unknown test case: " + testCase);
        }
    }
 
Example 2
Project: EMC-Installer   File: Installer.java   Source Code and License 7 votes vote down vote up
public Installer(JsonObject json) {
	this.versions = json.entrySet();
	System.out.println(versions.toString());
	String low = "", high = "";
	for (Map.Entry<String, JsonElement> entry : versions) {
		if (high.isEmpty()) {
			high = entry.getKey();
		} else {
			low = entry.getKey();
		}
	}
	v = (low.isEmpty() ? high : low + "-" + high);
	try {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	} catch (Exception e) {
		e.printStackTrace();
	}
	this.setTitle(Main.name + " Installer");
	this.initGui();
}
 
Example 3
Project: Equella   File: BaseUtility.java   Source Code and License 7 votes vote down vote up
@SuppressWarnings("nls")
protected BaseUtility()
{
	try
	{
		UIManager.setLookAndFeel(new FlatterLookAndFeel());
		System.setProperty("org.apache.commons.logging.LogFactory",
			"org.apache.commons.logging.impl.SLF4JLogFactory");
		BlindSSLSocketFactory.register();
		AxisProperties.setProperty("axis.socketSecureFactory",
			"org.apache.axis.components.net.SunFakeTrustSocketFactory");
	}
	catch( UnsupportedLookAndFeelException e )
	{
		throw new RuntimeException(e);
	}
	data = new SharedData();
	createGUI();
}
 
Example 4
Project: incubator-netbeans   File: OptionsAction.java   Source Code and License 7 votes vote down vote up
protected TreeView initGui () {
    TTW retVal = new TTW () ;
    
    
    split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT);
    PropertySheetView propertyView = new PropertySheetView();
    
    split.setLeftComponent(retVal);
    split.setRightComponent(propertyView);
    // install proper border for split pane
    split.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N

    setLayout (new java.awt.GridBagLayout ());

    GridBagConstraints gridBagConstraints = new GridBagConstraints ();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.gridwidth = 2;
    add (split, gridBagConstraints);

    return retVal;
}
 
Example 5
Project: incubator-netbeans   File: HtmlLabelUI.java   Source Code and License 7 votes vote down vote up
/** Get the system-wide unfocused selection background color */
private static Color getUnfocusedSelectionBackground() {
    if (unfocusedSelBg == null) {
        //allow theme/ui custom definition
        unfocusedSelBg = UIManager.getColor("nb.explorer.unfocusedSelBg"); //NOI18N
        
        if (unfocusedSelBg == null) {
            //try to get standard shadow color
            unfocusedSelBg = UIManager.getColor("controlShadow"); //NOI18N
            
            if (unfocusedSelBg == null) {
                //Okay, the look and feel doesn't suport it, punt
                unfocusedSelBg = Color.lightGray;
            }

            //Lighten it a bit because disabled text will use controlShadow/
            //gray
            if (!Color.WHITE.equals(unfocusedSelBg.brighter())) {
                unfocusedSelBg = unfocusedSelBg.brighter();
            }
        }
    }

    return unfocusedSelBg;
}
 
Example 6
Project: Pixie   File: GUILabelingTool.java   Source Code and License 7 votes vote down vote up
/**
 * The entry point of application.
 *
 * @param args the command line arguments
 */
public static void main(String[] args) {
    Logger logger = LoggerFactory.getLogger(GUILabelingTool.class);
    System.getProperty("java.library.path");

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(() -> {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            //  SplashScreen.startSplash()

            GUILabelingTool gui = new GUILabelingTool(logger);
            gui.setVisible(true);
            // for the first run, some special configuration have to be done
            gui.firstStartInitialization();

        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            logger.error("Create and display form");
            logger.debug("Create and display form {}", ex);
        }
    });
}
 
Example 7
Project: AgentWorkbench   File: ProgressMonitor.java   Source Code and License 6 votes vote down vote up
/**
 * Sets the look and feel of the dialog similar to the current application window
 */
private void setLookAndFeel() {

	// --- Some exit options --------------------------
	if (this.lookAndFeelClassName==null) return;
	
	String currLookAndFeelClassName = UIManager.getLookAndFeel().getClass().getName();
	if (this.lookAndFeelClassName.equals(currLookAndFeelClassName)==true) return;

	// --- Try to set the look and feel ---------------
	try {
		UIManager.setLookAndFeel(this.lookAndFeelClassName);
		SwingUtilities.updateComponentTreeUI(this.getProgressMonitorContainer());				
	} catch (Exception ex) {
		System.err.println("Cannot install " + this.lookAndFeelClassName + " on this platform:" + ex.getMessage());
	}	
}
 
Example 8
Project: Neukoelln_SER316   File: TaskTable.java   Source Code and License 6 votes vote down vote up
/**
     * updateUI is overridden to set the colors of the Tree's renderer to
     * match that of the table.
     */
    public void updateUI() {
        super.updateUI();
 
        // Make the tree's cell renderer use the table's cell selection
        // colors.
        TreeCellRenderer tcr = getCellRenderer();
        if (tcr instanceof DefaultTreeCellRenderer) {
            DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
 
dtcr.setBorderSelectionColor(null);
            dtcr.setTextSelectionColor(UIManager
                    .getColor("Table.selectionForeground"));
            dtcr.setBackgroundSelectionColor(UIManager
                    .getColor("Table.selectionBackground"));
        }
    }
 
Example 9
Project: jdk8u-jdk   File: DefaultEditorKit.java   Source Code and License 6 votes vote down vote up
/** The operation to perform when this action is triggered. */
public void actionPerformed(ActionEvent e) {
    JTextComponent target = getTextComponent(e);
    if (target != null) {
        try {
            int offs = target.getCaretPosition();
            int begOffs = Utilities.getWordStart(target, offs);
            if (select) {
                target.moveCaretPosition(begOffs);
            } else {
                target.setCaretPosition(begOffs);
            }
        } catch (BadLocationException bl) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
        }
    }
}
 
Example 10
Project: openjdk-jdk10   File: Test4319113.java   Source Code and License 6 votes vote down vote up
private void show(Window window) {
    JButton jButton = new JButton("Show ColorChooser");
    jButton.setActionCommand("Show ColorChooser");
    jButton.addActionListener(this);
    this.cbPlaf = new JComboBox<UIManager.LookAndFeelInfo>(UIManager.getInstalledLookAndFeels());
    this.cbPlaf.addItemListener(new ItemListener(){

        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            if (itemEvent.getStateChange() == 1) {
                SwingUtilities.invokeLater(new Runnable(){

                    @Override
                    public void run() {
                        UIManager.LookAndFeelInfo lookAndFeelInfo = (UIManager.LookAndFeelInfo)Test4319113.this.cbPlaf.getSelectedItem();
                        try {
                            UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
                            Frame[] arrframe = Frame.getFrames();
                            int n = arrframe.length;
                            while (--n >= 0) {
                                Test4319113.updateWindowTreeUI(arrframe[n]);
                            }
                        }
                        catch (Exception var2_3) {
                            System.err.println("Exception while changing L&F!");
                        }
                    }
                });
            }
        }

    });
    window.add(this.cbPlaf);
    window.add(jButton);
    window.pack();
    window.setVisible(true);
}
 
Example 11
Project: openjdk-jdk10   File: MenuItemIconTest.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    robot = new Robot();
    String name = UIManager.getSystemLookAndFeelClassName();
    try {
        UIManager.setLookAndFeel(name);
    } catch (ClassNotFoundException | InstantiationException |
            IllegalAccessException | UnsupportedLookAndFeelException e) {
        throw new RuntimeException("Test Failed");
    }
    createUI();
    robot.waitForIdle();
    executeTest();
    if (!"".equals(errorMessage)) {
        throw new RuntimeException(errorMessage);
    }
}
 
Example 12
Project: incubator-netbeans   File: DebuggingViewComponent.java   Source Code and License 6 votes vote down vote up
private static Color getTreeBackgroundColor() {
    Color c = null;
    if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {                //NOI18N
        c = UIManager.getColor("NbExplorerView.background");                //NOI18N
    }
    if (c == null) {
        c = UIManager.getColor("Tree.textBackground");                      // NOI18N
    }
    return c;
}
 
Example 13
Project: school-game   File: ToolsLauncher.java   Source Code and License 6 votes vote down vote up
/**
 * Einstiegspunkt für das Tool.
 *
 * @param args wird nicht beachtet
 * @throws Exception unterschiedliche Ursachen
 */
public static void main(String[] args) throws Exception {

    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new ToolsLauncher();
        }
    });
}
 
Example 14
Project: incubator-netbeans   File: ColorHelper.java   Source Code and License 6 votes vote down vote up
public static Color getJxdatetimepickerMonthStringBackground() {
    Color managerColor = UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground");
    if (managerColor == null) {
        UIManager.put("nb.dataview.jxdatetimepicker.monthStringBackground", UIManager.getColor("JXMonthView.monthStringBackground")); //NOI18N
        return UIManager.getColor("nb.dataview.jxdatetimepicker.monthStringBackground"); //NOI18N
    } else {
        return managerColor;
    }
}
 
Example 15
Project: incubator-netbeans   File: AquaViewTabDisplayerUI.java   Source Code and License 6 votes vote down vote up
@Override
protected void paintTabBackground(Graphics g, int index, int x, int y,
                                  int width, int height) {
    Graphics2D g2d = (Graphics2D) g;
    Paint p = g2d.getPaint();
    if( isSelected(index) ) {
        g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.selectedTabBrighterBackground"),
                x, y+height/2, UIManager.getColor("NbTabControl.selectedTabDarkerBackground")) );
    } else if( isMouseOver(index) ) {
        g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.mouseoverTabBrighterBackground"),
                x, y+height/2, UIManager.getColor("NbTabControl.mouseoverTabDarkerBackground")) );
    } else {
        g2d.setPaint( ColorUtil.getGradientPaint(x, y, UIManager.getColor("NbTabControl.inactiveTabBrighterBackground"),
                x, y+height/2, UIManager.getColor("NbTabControl.inactiveTabDarkerBackground")) );
    }
    g2d.fillRect(x, y, width, height);
    g2d.setPaint(p);
}
 
Example 16
Project: FJSTSeniorProjectSpring2017   File: RegisterGUI.java   Source Code and License 6 votes vote down vote up
/** Creates new form RegisterGUI */
public RegisterGUI() {
	/* Set Nimbus look and feel. */
	try {
		for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
			if ("Nimbus".equals(info.getName())) {
				UIManager.setLookAndFeel(info.getClassName());
				break;
			}
		}
	} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException exception) {
		java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, exception);
	}
	initComponents();
	Utils.setWindowCenterOfScreen(this);
	setVisible(true);
}
 
Example 17
Project: jdk8u-jdk   File: MenuItemIconTest.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    robot = new Robot();
    String name = UIManager.getSystemLookAndFeelClassName();
    try {
        UIManager.setLookAndFeel(name);
    } catch (ClassNotFoundException | InstantiationException |
            IllegalAccessException | UnsupportedLookAndFeelException e) {
        throw new RuntimeException("Test Failed");
    }
    createUI();
    robot.waitForIdle();
    executeTest();
    if (!"".equals(errorMessage)) {
        throw new RuntimeException(errorMessage);
    }
}
 
Example 18
Project: openjdk-jdk10   File: TableHeaderRendererExceptionTest.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) throws Throwable {
    //Execute test for all supported look and feels
    UIManager.LookAndFeelInfo[] lookAndFeelArray
            = UIManager.getInstalledLookAndFeels();

    for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
        String lookAndFeelString = lookAndFeelItem.getClassName();

        UIManager.setLookAndFeel(lookAndFeelString);

        // Test getTableCellRendererComponent method by passing null table
        JTableHeader header = new JTableHeader();

        header.getDefaultRenderer().getTableCellRendererComponent(null,
                " test ", true, true, -1, 0);
    }
}
 
Example 19
Project: incubator-netbeans   File: NotificationImpl.java   Source Code and License 6 votes vote down vote up
private JComponent createDetails( String text, ActionListener action ) {
    if( null == action ) {
        return new JLabel(text);
    }
    try {
        text = "<html><u>" + XMLUtil.toElementContent(text); //NOI18N
    } catch( CharConversionException ex ) {
        throw new IllegalArgumentException(ex);
    }
    JButton btn = new JButton(text);
    btn.setFocusable(false);
    btn.setBorder(BorderFactory.createEmptyBorder());
    btn.setBorderPainted(false);
    btn.setFocusPainted(false);
    btn.setOpaque(false);
    btn.setContentAreaFilled(false);
    btn.addActionListener(action);
    btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
    if (c != null) {
        btn.setForeground(c);
    }
    return btn;
}
 
Example 20
Project: swing-memory-game   File: MemoryGame.java   Source Code and License 6 votes vote down vote up
/**
 * Apply system default look and feel L&F.
 */
public static void lookF()
{
    log.debug("Trying to apply default system look and feel...");

    try
    {
        // Set to System L&F :
        //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        // Set cross-platform Java L&F (also called "Metal")
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");

        log.debug("Success.");

    } catch (Exception e)
    {
        log.debug("Error setting system look an feel : " + e);
    }
}
 
Example 21
Project: ObsidianSuite   File: ObsidianAnimator.java   Source Code and License 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{		
	FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addVersionCheck", VERSION_LINK);
	
	instance = this;		
	proxy.init();
       
       EventHandler eventHandler = new EventHandler();
       MinecraftForge.EVENT_BUS.register(eventHandler);
	
       if(FMLCommonHandler.instance().getEffectiveSide().isClient())
           FMLCommonHandler.instance().bus().register(eventHandler);
       
       //Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false;
       Minecraft.getMinecraft().gameSettings.saveOptions();
       
       //Stop space from activating buttons, allowing it to be used for adding keyframes in the timeline.
       InputMap im = (InputMap)UIManager.get("Button.focusInputMap");
       im.put(KeyStroke.getKeyStroke("pressed SPACE"), "none");
       im.put(KeyStroke.getKeyStroke("released SPACE"), "none");
}
 
Example 22
Project: jdk8u-jdk   File: TableExample2.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
Example 23
Project: incubator-netbeans   File: RunAnalysisPanel.java   Source Code and License 6 votes vote down vote up
@Messages({"LBL_RunAllAnalyzers=All Analyzers", "# {0} - the analyzer that should be run", "LBL_RunAnalyzer={0}"})
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    if (value == null) {
        value = Bundle.LBL_RunAllAnalyzers();
    } else if (value instanceof AnalyzerFactory) {
        value = Bundle.LBL_RunAnalyzer(SPIAccessor.ACCESSOR.getAnalyzerDisplayName((AnalyzerFactory) value));
    } else if (value instanceof Configuration) {
        value = ((Configuration) value).getDisplayName();
    } else if (value instanceof String) {
        setFont(getFont().deriveFont(Font.ITALIC));
        setText((String) value);
        setEnabled(false);
        setBackground(list.getBackground());
        setForeground(UIManager.getColor("Label.disabledForeground"));

        return this;
    }

    if (index == list.getModel().getSize()-5 && list.getModel() instanceof ConfigurationsComboModel && ((ConfigurationsComboModel) list.getModel()).canModify()) {
        setBorder(new Separator(list.getForeground()));
    } else {
        setBorder(null);
    }

    return super.getListCellRendererComponent(list, (indent ? "  " : "") + value, index, isSelected, cellHasFocus);
}
 
Example 24
Project: incubator-netbeans   File: ProjectInfoPanel.java   Source Code and License 6 votes vote down vote up
/** Creates new form ProjectInfoPanel */
public ProjectInfoPanel(Lookup lookup) {
    super(lookup);
    initComponents();
    btnCheckout.setIcon(null);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
        setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
        this.jPanel1.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
        this.pnlCim.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
        this.pnlIssues.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
        this.pnlLicense.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
        this.jPanel4.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
        this.pnlMailingLists.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
        this.pnlScm.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
    }
}
 
Example 25
Project: incubator-netbeans   File: TermOptionsPanel.java   Source Code and License 6 votes vote down vote up
private void fontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontButtonActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
    pe.setValue(termOptions.getFont());
    DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(), FontChooser_title());

    String defaultFontString = FontChooser_defaultFont_label();
    dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
	defaultFontString, DialogDescriptor.CANCEL_OPTION});  //NOI18N
    DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
    if (dd.getValue() == DialogDescriptor.OK_OPTION) {
	Font f = (Font) pe.getValue();
	termOptions.setFont(f);
	applyTermOptions();
    } else if (dd.getValue() == defaultFontString) {
	Font controlFont = UIManager.getFont("controlFont");			//NOI18N
	int fontSize = (controlFont == null) ? 12 : controlFont.getSize();
	termOptions.setFont(new Font("monospaced", Font.PLAIN, fontSize));	//NOI18N
    }
}
   }
 
Example 26
Project: OpenJSharp   File: DefaultEditorKit.java   Source Code and License 6 votes vote down vote up
/** The operation to perform when this action is triggered. */
public void actionPerformed(ActionEvent e) {
    JTextComponent target = getTextComponent(e);
    if (target != null) {
        try {
            int offs = target.getCaretPosition();
            int endOffs = Utilities.getWordEnd(target, offs);
            if (select) {
                target.moveCaretPosition(endOffs);
            } else {
                target.setCaretPosition(endOffs);
            }
        } catch (BadLocationException bl) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
        }
    }
}
 
Example 27
Project: VisualGraphviz   File: MainFrame.java   Source Code and License 6 votes vote down vote up
private void init(int w, int h) {
    this.setBounds((Toolkit.getDefaultToolkit().getScreenSize().width - w) / 2,
            (Toolkit.getDefaultToolkit().getScreenSize().height - h) / 2, w, h);
    this.setTitle("Visual Graphviz v1.04");
    this.setFont(buttonFont);
    this.setLayout(null);

    /* set close operation */
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    /* set window style */
    try {
        /* UIManager.setLookAndFeel(WINDOWS_STYLE); */
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
            | UnsupportedLookAndFeelException e) {
        e.printStackTrace();
    }

    /* this.setResizable(false); */

    container = this.getContentPane();
    container.setLayout(null);
}
 
Example 28
Project: NoMoreOversleeps   File: Main.java   Source Code and License 6 votes vote down vote up
static void complain(String message) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException, URISyntaxException, InterruptedException
{
	// Resort to a Swing Y/N dialog asking if the user wants to update Java.
	// If they click yes, their default browser will open to the JAVA_UPDATE_URL
	UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	int reply = JOptionPane.showConfirmDialog(null, message, "NoMoreOversleeps", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE);
	if (reply == 0)
	{
		String platformCode = "";
		if (PlatformData.platformType == PlatformType.WINDOWS)
		{
			platformCode = PlatformData.is64bitOS ? "?platform=win64" : "?platform=win32";
		}
		else if (PlatformData.platformType == PlatformType.MAC)
		{
			platformCode = "?platform=mac";
		}
		else
		{
			platformCode = "?platform=linux";
		}
		java.awt.Desktop.getDesktop().browse(new URI(Main.JAVA_UPDATE_URL + platformCode));
		Thread.sleep(100);
	}
}
 
Example 29
Project: Rubus   File: SetupUtils.java   Source Code and License 5 votes vote down vote up
static synchronized Border getEtchedBorder() {
    if (etchedBorder == null) {
        etchedBorder = UIManager.getBorder( "TitledBorder.aquaVariant" );
        if (etchedBorder == null)
            etchedBorder = BorderFactory.createCompoundBorder(new EtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5));
    }
    return etchedBorder;
}
 
Example 30
Project: openjdk-jdk10   File: MetalThemeMenu.java   Source Code and License 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    String numStr = e.getActionCommand();
    MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
    MetalLookAndFeel.setCurrentTheme(selectedTheme);
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
        System.out.println("Failed loading Metal");
        System.out.println(ex);
    }

}
 
Example 31
Project: Reinickendorf_SER316   File: SetApplicationPanel.java   Source Code and License 5 votes vote down vote up
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 32
Project: incubator-netbeans   File: OutputOptions.java   Source Code and License 5 votes vote down vote up
static Color getDefaultColorError() {
    Color err = UIManager.getColor("nb.output.err.foreground");     //NOI18N
    if (err == null) {
        err = LFCustoms.shiftColor(Color.red);
    }
    return err;
}
 
Example 33
Project: jdk8u-jdk   File: NimbusLookAndFeel.java   Source Code and License 5 votes vote down vote up
Map<String, Object> getDefaultsForPrefix(String prefix) {
    if (compiledDefaults == null) {
        compiledDefaults = new HashMap<String, Map<String, Object>>();
        for (Map.Entry<Object, Object> entry: UIManager.getDefaults().entrySet()) {
            if (entry.getKey() instanceof String) {
                addDefault((String) entry.getKey(), entry.getValue());
            }
        }
        if (! defaultListenerAdded) {
            UIManager.getDefaults().addPropertyChangeListener(defaultsListener);
            defaultListenerAdded = true;
        }
    }
    return compiledDefaults.get(prefix);
}
 
Example 34
Project: incubator-netbeans   File: BoldVariablesTableModelFilter.java   Source Code and License 5 votes vote down vote up
public static String toHTML (
    String text,
    boolean bold,
    boolean italics,
    Color color
) {
    if (text == null) return null;
    StringBuilder sb = new StringBuilder ();
    sb.append ("<html>");
    if (bold) sb.append ("<b>");
    if (italics) sb.append ("<i>");
    if (color == null) {
        color = UIManager.getColor("Table.foreground");
        if (color == null) {
            color = new JTable().getForeground();
        }
    }
    sb.append ("<font color=\"#");
    String hexColor = Integer.toHexString ((color.getRGB () & 0xffffff));
    for (int i = hexColor.length(); i < 6; i++) {
        sb.append("0"); // Prepend zeros to length of 6
    }
    sb.append(hexColor);
    sb.append ("\">");
    text = text.replaceAll ("&", "&amp;");
    text = text.replaceAll ("<", "&lt;");
    text = text.replaceAll (">", "&gt;");
    sb.append (text);
    sb.append ("</font>");
    if (italics) sb.append ("</i>");
    if (bold) sb.append ("</b>");
    sb.append ("</html>");
    return sb.toString ();
}
 
Example 35
Project: jdk8u-jdk   File: WindowsSplitPaneDivider.java   Source Code and License 5 votes vote down vote up
/**
  * Paints the divider.
  */
public void paint(Graphics g) {
    Color bgColor = (splitPane.hasFocus()) ?
                        UIManager.getColor("SplitPane.shadow") :
                        getBackground();
    Dimension size = getSize();

    if(bgColor != null) {
        g.setColor(bgColor);
        g.fillRect(0, 0, size.width, size.height);
    }
    super.paint(g);
}
 
Example 36
Project: openjdk-jdk10   File: bug8008657.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        robot = new Robot();
        UIManager.LookAndFeelInfo[] lookAndFeelArray
                = UIManager.getInstalledLookAndFeels();
        for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
            executeCase(lookAndFeelItem.getClassName());
        }

    }
 
Example 37
Project: jdk8u-jdk   File: Test6860438.java   Source Code and License 5 votes vote down vote up
void test() {
    int size = UIManager.getDefaults().size();

    // create a new value, size increases
    UIManager.getLookAndFeelDefaults().put(KEY, VALUE);
    check(KEY, VALUE, true, size + 1);

    // override the value, size remains the same
    UIManager.put(KEY, VALUE);
    check(KEY, VALUE, true, size + 1);

    // remove the value, size decreases
    UIManager.getDefaults().remove(KEY);
    check(KEY, null, false, size);
}
 
Example 38
Project: SER316-Ingolstadt   File: SetApplicationPanel.java   Source Code and License 5 votes vote down vote up
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 39
Project: openjdk-jdk10   File: JInternalFrameIconTest.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    robot = new Robot();
    robot.delay(2000);
    UIManager.LookAndFeelInfo[] lookAndFeelArray
            = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
        executeCase(lookAndFeelItem.getClassName());
    }
    if (!"".equals(errorString)) {
        throw new RuntimeException("Error Log:\n" + errorString);
    }

}
 
Example 40
Project: incubator-netbeans   File: ButtonCellRenderer.java   Source Code and License 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent (
    JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column
) {
    JLabel c = (JLabel)defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    
    if (value instanceof String) {
        Rectangle cellRect = table.getCellRect(row, column, false);
        String scCell = (String) value;
        Dimension d = new Dimension((int) cellRect.getWidth(), (int) cellRect.getHeight());
        if (panel == null)
            panel = new ShortcutCellPanel(scCell);
        panel.setText(scCell);
        panel.setSize(d);

        if (isSelected) {
            panel.setBgColor(table.getSelectionBackground());
            if (UIManager.getLookAndFeel ().getID ().equals ("GTK"))
                panel.setFgCOlor(table.getForeground(), true);
            else
                panel.setFgCOlor(table.getSelectionForeground(), true);
        } else {
            panel.setBgColor(c.getBackground());
            panel.setFgCOlor(c.getForeground(), false);
        }
        if (hasFocus) {
            panel.setBorder(c.getBorder());
        } else {
            panel.setBorder(null);
        }

        return panel;
    }
    else {
        return c;
    }
}
 
Example 41
Project: OpenJSharp   File: BasicLookAndFeel.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the parent of the passed in ActionMap to be the audio action
 * map.
 */
static void installAudioActionMap(ActionMap map) {
    LookAndFeel laf = UIManager.getLookAndFeel();
    if (laf instanceof BasicLookAndFeel) {
        map.setParent(((BasicLookAndFeel)laf).getAudioActionMap());
    }
}
 
Example 42
Project: smile_1.5.0_java7   File: ButtonCellRenderer.java   Source Code and License 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    if (isSelected) {
        renderButton.setForeground(table.getSelectionForeground());
        renderButton.setBackground(table.getSelectionBackground());
    } else {
        renderButton.setForeground(table.getForeground());
        renderButton.setBackground(UIManager.getColor("Button.background"));
    }

    if (hasFocus) {
        renderButton.setBorder(focusBorder);
    } else {
        renderButton.setBorder(originalBorder);
    }

    if (value == null) {
        renderButton.setText("");
        renderButton.setIcon(null);
        renderButton.setEnabled(false);
    } else if (value instanceof Icon) {
        renderButton.setText("");
        renderButton.setIcon((Icon) value);
        renderButton.setEnabled(true);
    } else {
        renderButton.setText(value.toString());
        renderButton.setIcon(null);
        renderButton.setEnabled(true);
    }

    return renderButton;
}
 
Example 43
Project: Wilmersdorf_SER316   File: SetApplicationPanel.java   Source Code and License 5 votes vote down vote up
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
Example 44
Project: OpenJSharp   File: WindowsLabelUI.java   Source Code and License 5 votes vote down vote up
protected void paintDisabledText(JLabel l, Graphics g, String s,
                                 int textX, int textY) {
    int mnemonicIndex = l.getDisplayedMnemonicIndex();
    // W2K Feature: Check to see if the Underscore should be rendered.
    if (WindowsLookAndFeel.isMnemonicHidden() == true) {
        mnemonicIndex = -1;
    }
    if ( UIManager.getColor("Label.disabledForeground") instanceof Color &&
         UIManager.getColor("Label.disabledShadow") instanceof Color) {
        g.setColor( UIManager.getColor("Label.disabledShadow") );
        SwingUtilities2.drawStringUnderlineCharAt(l, g, s,
                                                     mnemonicIndex,
                                                     textX + 1, textY + 1);
        g.setColor( UIManager.getColor("Label.disabledForeground") );
        SwingUtilities2.drawStringUnderlineCharAt(l, g, s,
                                                     mnemonicIndex,
                                                     textX, textY);
    } else {
        Color background = l.getBackground();
        g.setColor(background.brighter());
        SwingUtilities2.drawStringUnderlineCharAt(l,g, s, mnemonicIndex,
                                                     textX + 1, textY + 1);
        g.setColor(background.darker());
        SwingUtilities2.drawStringUnderlineCharAt(l,g, s, mnemonicIndex,
                                                     textX, textY);
    }
}
 
Example 45
Project: incubator-netbeans   File: NimbusScrollPaneBorder.java   Source Code and License 5 votes vote down vote up
@Override
public void paintBorder(Component c, Graphics g, int x, int y,
int w, int h) {
    g.translate(x, y);

    Color color = UIManager.getColor("controlShadow");
    g.setColor(color == null ? Color.darkGray : color);
    g.drawRect(0, 0, w-2, h-2);
    color = UIManager.getColor("controlHighlight");
    g.setColor(color == null ? Color.white : color);
    g.drawLine(w-1, 1, w-1, h-1);
    g.drawLine(1, h-1, w-1, h-1);

    g.translate(-x, -y);
}
 
Example 46
Project: marathonv5   File: TabbedPaneDemo.java   Source Code and License 5 votes vote down vote up
public static void main(String[] args) {
    // Schedule a job for the event dispatch thread:
    // creating and showing this application's GUI.
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            // Turn off metal's use of bold fonts
            UIManager.put("swing.boldMetal", Boolean.FALSE);
            createAndShowGUI();
        }
    });
}
 
Example 47
Project: openjdk-jdk10   File: bug8081411.java   Source Code and License 5 votes vote down vote up
private static void testSynthIcon() {

        if (!checkAndSetNimbusLookAndFeel()) {
            return;
        }

        JMenuItem menu = new JMenuItem();
        Icon subMenuIcon = UIManager.getIcon("Menu.arrowIcon");

        if (!(subMenuIcon instanceof SynthIcon)) {
            throw new RuntimeException("Icon is not a SynthIcon!");
        }

        Region region = SynthLookAndFeel.getRegion(menu);
        SynthStyle style = SynthLookAndFeel.getStyle(menu, region);
        SynthContext synthContext = new SynthContext(menu, region, style, SynthConstants.ENABLED);

        int width = SynthGraphicsUtils.getIconWidth(subMenuIcon, synthContext);
        int height = SynthGraphicsUtils.getIconHeight(subMenuIcon, synthContext);
        paintAndCheckIcon(subMenuIcon, synthContext, width, height);

        int newWidth = width * 17;
        int newHeight = height * 37;
        Icon centeredIcon = new CenteredSynthIcon((SynthIcon) subMenuIcon,
                newWidth, newHeight);
        paintAndCheckIcon(centeredIcon, synthContext, newWidth, newHeight);
    }
 
Example 48
Project: powertext   File: RSyntaxTextAreaEditorKit.java   Source Code and License 5 votes vote down vote up
@Override
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
	RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
	if (rsta.isCodeFoldingEnabled()) {
		FoldCollapser collapser = new FoldCollapser();
		collapser.collapseFolds(rsta.getFoldManager());
		RSyntaxUtilities.possiblyRepaintGutter(textArea);
	}
	else {
		UIManager.getLookAndFeel().provideErrorFeedback(rsta);
	}
}
 
Example 49
Project: incubator-netbeans   File: OptionsPanel.java   Source Code and License 5 votes vote down vote up
private static Color getTabPanelBackground() {
    if( isMetal || isNimbus ) {
        Color res = UIManager.getColor( "Tree.background" ); //NOI18N
        if( null == res )
            res = Color.white;
        return new Color( res.getRGB() );
    }
    return Color.white;
}
 
Example 50
Project: incubator-netbeans   File: DefaultTabbedContainerUI.java   Source Code and License 5 votes vote down vote up
public void paintBorder(Component c, Graphics g, int x, int y, int w,
                        int h) {
    g.translate(x, y);

    g.setColor(UIManager.getColor("controlShadow")); //NOI18N
    g.drawRect(0, 0, w - 2, h - 2);
    g.setColor(UIManager.getColor("controlHighlight")); //NOI18N
    g.drawLine(w - 1, 1, w - 1, h - 1);
    g.drawLine(1, h - 1, w - 1, h - 1);

    g.translate(-x, -y);
}
 
Example 51
Project: QN-ACTR-Release   File: RowHeaderRenderer.java   Source Code and License 5 votes vote down vote up
public RowHeaderRenderer(JTable table) {
	JTableHeader header = table.getTableHeader();
	setOpaque(true);
	setBorder(UIManager.getBorder("TableHeader.cellBorder"));
	setHorizontalAlignment(CENTER);
	setForeground(header.getForeground());
	setBackground(header.getBackground());
	setFont(header.getFont());
}
 
Example 52
Project: SER316-Munich   File: FontDialog.java   Source Code and License 5 votes vote down vote up
void colorB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put(
	"ColorChooser.swatchesNameText",
	Local.getString("Swatches"));
UIManager.put("ColorChooser.hsbNameText", Local.getString("HSB"));
UIManager.put("ColorChooser.rgbNameText", Local.getString("RGB"));
UIManager.put(
	"ColorChooser.swatchesRecentText",
	Local.getString("Recent:"));
UIManager.put("ColorChooser.previewText", Local.getString("Preview"));
UIManager.put(
	"ColorChooser.sampleText",
	Local.getString("Sample Text")
		+ " "
		+ Local.getString("Sample Text"));
UIManager.put("ColorChooser.okText", Local.getString("OK"));
UIManager.put("ColorChooser.cancelText", Local.getString("Cancel"));
UIManager.put("ColorChooser.resetText", Local.getString("Reset"));
UIManager.put("ColorChooser.hsbHueText", Local.getString("H"));
UIManager.put("ColorChooser.hsbSaturationText", Local.getString("S"));
UIManager.put("ColorChooser.hsbBrightnessText", Local.getString("B"));
UIManager.put("ColorChooser.hsbRedText", Local.getString("R"));
UIManager.put("ColorChooser.hsbGreenText", Local.getString("G"));
UIManager.put("ColorChooser.hsbBlueText", Local.getString("B2"));
UIManager.put("ColorChooser.rgbRedText", Local.getString("Red"));
UIManager.put("ColorChooser.rgbGreenText", Local.getString("Green"));
UIManager.put("ColorChooser.rgbBlueText", Local.getString("Blue"));        
      Color c = JColorChooser.showDialog(this, Local.getString("Font color"), 
      	Util.decodeColor(colorField.getText()));
      if (c == null) return;
      colorField.setText(Util.encodeColor(c));
      Util.setColorField(colorField);
      sample.setForeground(c);
  }
 
Example 53
Project: incubator-netbeans   File: TransparentSectionButton.java   Source Code and License 5 votes vote down vote up
@Override
public Color getForeground() {
    if( isFocusOwner() ) {
        if( isAqua )
            return UIManager.getColor( "Table.foreground" ); //NOI18N
        else if( isGTK || isNimbus )
            return UIManager.getColor( "Tree.selectionForeground" ); //NOI18N
        return UIManager.getColor( "PropSheet.selectedSetForeground" ); //NOI18N
    } else {
        if( isAqua ) {
            Color res = UIManager.getColor("PropSheet.setForeground"); //NOI18N

            if (res == null) {
                res = UIManager.getColor("Table.foreground"); //NOI18N

                if (res == null) {
                    res = UIManager.getColor("textText");

                    if (res == null) {
                        res = Color.BLACK;
                    }
                }
            }
            return res;
        }
        if( isGTK || isNimbus ) {
            return new Color( UIManager.getColor( "Menu.foreground" ).getRGB() ); //NOI18N
        }
        return super.getForeground();
    }
}
 
Example 54
Project: incubator-netbeans   File: SummaryCellRenderer.java   Source Code and License 5 votes vote down vote up
public RevisionRenderer() {
    selectionForeground = new JList().getSelectionForeground();
    expandButton = new LinkButton(ICON_COLLAPSED);
    expandButton.setBorder(BorderFactory.createEmptyBorder());

    this.setBorder(BorderFactory.createMatteBorder(3, 0, 0, 0, UIManager.getColor("List.background"))); //NOI18N
    this.setLayout(new BorderLayout(3, 0));

    expandButton.setMaximumSize(expandButton.getPreferredSize());
    expandButton.setMinimumSize(expandButton.getPreferredSize());
    this.add(expandButton, BorderLayout.WEST);
    this.add(revisionCell, BorderLayout.CENTER);
}
 
Example 55
Project: ramus   File: RowFindPanel.java   Source Code and License 5 votes vote down vote up
/**
 * @param text
 */
protected void findp(final String text) {
    final boolean res = find(text, jCheckBox.isSelected());
    if (res)
        jTextField
                .setBackground(UIManager.getColor("TextField.background"));
    else
        jTextField.setBackground(Color.red);
}
 
Example 56
Project: brModelo   File: Aplicacao.java   Source Code and License 5 votes vote down vote up
private static void initLookAndFeel() {
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        util.BrLogger.Logger("ERROR_APP_LOAD_UI", ex.getMessage());
    }

}
 
Example 57
Project: openjdk-jdk10   File: bug8067346.java   Source Code and License 5 votes vote down vote up
private int testMargin() {

        for (int inx = 0; inx < menuClasses.length; inx++) {
            Insets margin = (Insets) UIManager.get(menuClasses[inx] + MARGIN);
            if (margin != null && margin.bottom == 0 && margin.left == 0
                    && margin.right == 0 && margin.top == 0) {
                return inx + 1;
            }
        }
        return 0;
    }
 
Example 58
Project: FreeCol   File: FreeColLookAndFeel.java   Source Code and License 5 votes vote down vote up
/**
 * Installs a FreeColLookAndFeel as the default look and feel.
 *
 * @param fclaf The {@code FreeColLookAndFeel} to install.
 * @throws FreeColException if the installation fails.
 */
public static void install(FreeColLookAndFeel fclaf)
    throws FreeColException {
    try {
        UIManager.setLookAndFeel(fclaf);
        UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
    } catch (UnsupportedLookAndFeelException e) {
        throw new FreeColException("Look and feel install failure", e);
    }
}
 
Example 59
Project: incubator-netbeans   File: IntegerCustomEditor.java   Source Code and License 5 votes vote down vote up
private Color getErrorColor() {
    Color c=UIManager.getColor(ERROR_FOREGROUND);
    if (c == null) {
        c = Color.RED;
    }
    return c;
}
 
Example 60
Project: incubator-netbeans   File: ColorHelper.java   Source Code and License 5 votes vote down vote up
public static Color getTableSqlconstantForeground() {
    Color managerColor = UIManager.getColor("nb.dataview.table.sqlconstant.foreground");
    if (managerColor == null) {
        if(isDarkTheme()) {
            UIManager.put("nb.dataview.table.sqlconstant.foreground", new Color(220, 220, 220)); //NOI18N
        } else {
            UIManager.put("nb.dataview.table.sqlconstant.foreground", Color.DARK_GRAY);
        }
        return UIManager.getColor("nb.dataview.table.sqlconstant.foreground"); //NOI18N
    } else {
        return managerColor;
    }
}