Search in sources :

Example 21 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project intellij-community by JetBrains.

the class IdeaLaf method initIdeaDefaults.

@SuppressWarnings({ "HardCodedStringLiteral" })
static void initIdeaDefaults(UIDefaults defaults) {
    defaults.put("Menu.maxGutterIconWidth", 18);
    defaults.put("MenuItem.maxGutterIconWidth", 18);
    // TODO[vova,anton] REMOVE!!! INVESTIGATE??? Borland???
    defaults.put("MenuItem.acceleratorDelimiter", "-");
    defaults.put("TitledBorder.titleColor", IdeaBlueMetalTheme.primary1);
    ColorUIResource col = new ColorUIResource(230, 230, 230);
    defaults.put("ScrollBar.background", col);
    defaults.put("ScrollBar.track", col);
    //Border scrollPaneBorder = new BorderUIResource(new BegBorders.ScrollPaneBorder());
    //defaults.put("ScrollPane.border", scrollPaneBorder);
    defaults.put("TextField.border", BegBorders.getTextFieldBorder());
    defaults.put("PasswordField.border", BegBorders.getTextFieldBorder());
    Border popupMenuBorder = new BegPopupMenuBorder();
    defaults.put("PopupMenu.border", popupMenuBorder);
    defaults.put("ScrollPane.border", BegBorders.getScrollPaneBorder());
    defaults.put("ButtonUI", BegButtonUI.class.getName());
    defaults.put("ToggleButtonUI", BegToggleButtonUI.class.getName());
    defaults.put("ComboBoxUI", BegComboBoxUI.class.getName());
    defaults.put("RadioButtonUI", BegRadioButtonUI.class.getName());
    defaults.put("CheckBoxUI", BegCheckBoxUI.class.getName());
    defaults.put("TabbedPaneUI", BegTabbedPaneUI.class.getName());
    defaults.put("TableUI", BegTableUI.class.getName());
    defaults.put("TreeUI", BegTreeUI.class.getName());
    //defaults.put("ScrollPaneUI", BegScrollPaneUI.class.getName());
    defaults.put("TabbedPane.tabInsets", new Insets(0, 4, 0, 4));
    defaults.put("ToolTip.background", TOOLTIP_BACKGROUND_COLOR);
    defaults.put("ToolTip.border", new ColoredSideBorder(Color.gray, Color.gray, Color.black, Color.black, 1));
    defaults.put("Tree.ancestorInputMap", null);
    defaults.put("FileView.directoryIcon", AllIcons.Nodes.Folder);
    defaults.put("FileChooser.upFolderIcon", AllIcons.Nodes.UpFolder);
    defaults.put("FileChooser.newFolderIcon", AllIcons.Nodes.NewFolder);
    defaults.put("FileChooser.homeFolderIcon", AllIcons.Nodes.HomeFolder);
    defaults.put("OptionPane.errorIcon", AllIcons.General.ErrorDialog);
    defaults.put("OptionPane.informationIcon", AllIcons.General.InformationDialog);
    defaults.put("OptionPane.warningIcon", AllIcons.General.WarningDialog);
    defaults.put("OptionPane.questionIcon", AllIcons.General.QuestionDialog);
    defaults.put("Tree.openIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class, "icons/TreeOpen.gif"));
    defaults.put("Tree.closedIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class, "icons/TreeClosed.gif"));
    defaults.put("Tree.leafIcon", LookAndFeel.makeIcon(WindowsLookAndFeel.class, "icons/TreeLeaf.gif"));
    defaults.put("Tree.expandedIcon", WindowsTreeUI.ExpandedIcon.createExpandedIcon());
    defaults.put("Tree.collapsedIcon", WindowsTreeUI.CollapsedIcon.createCollapsedIcon());
    defaults.put("Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] { "ctrl C", "copy", "ctrl V", "paste", "ctrl X", "cut", "COPY", "copy", "PASTE", "paste", "CUT", "cut", "control INSERT", "copy", "shift INSERT", "paste", "shift DELETE", "cut", "RIGHT", "selectNextColumn", "KP_RIGHT", "selectNextColumn", "LEFT", "selectPreviousColumn", "KP_LEFT", "selectPreviousColumn", "DOWN", "selectNextRow", "KP_DOWN", "selectNextRow", "UP", "selectPreviousRow", "KP_UP", "selectPreviousRow", "shift RIGHT", "selectNextColumnExtendSelection", "shift KP_RIGHT", "selectNextColumnExtendSelection", "shift LEFT", "selectPreviousColumnExtendSelection", "shift KP_LEFT", "selectPreviousColumnExtendSelection", "shift DOWN", "selectNextRowExtendSelection", "shift KP_DOWN", "selectNextRowExtendSelection", "shift UP", "selectPreviousRowExtendSelection", "shift KP_UP", "selectPreviousRowExtendSelection", "PAGE_UP", "scrollUpChangeSelection", "PAGE_DOWN", "scrollDownChangeSelection", "HOME", "selectFirstColumn", "END", "selectLastColumn", "shift PAGE_UP", "scrollUpExtendSelection", "shift PAGE_DOWN", "scrollDownExtendSelection", "shift HOME", "selectFirstColumnExtendSelection", "shift END", "selectLastColumnExtendSelection", "ctrl PAGE_UP", "scrollLeftChangeSelection", "ctrl PAGE_DOWN", "scrollRightChangeSelection", "ctrl HOME", "selectFirstRow", "ctrl END", "selectLastRow", "ctrl shift PAGE_UP", "scrollRightExtendSelection", "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection", "ctrl shift HOME", "selectFirstRowExtendSelection", "ctrl shift END", "selectLastRowExtendSelection", "TAB", "selectNextColumnCell", "shift TAB", "selectPreviousColumnCell", //"ENTER", "selectNextRowCell",
    "shift ENTER", "selectPreviousRowCell", "ctrl A", "selectAll", //"ESCAPE", "cancel",
    "F2", "startEditing" }));
}
Also used : ColorUIResource(javax.swing.plaf.ColorUIResource) WindowsLookAndFeel(com.sun.java.swing.plaf.windows.WindowsLookAndFeel) ColoredSideBorder(com.intellij.ui.ColoredSideBorder) Border(javax.swing.border.Border) ColoredSideBorder(com.intellij.ui.ColoredSideBorder)

Example 22 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project adempiere by adempiere.

the class AdempiereTaskPaneUI method update.

/**
	 * Overriden to paint the background of the component but keeping the
	 * rounded corners.
	 */
public void update(Graphics g, JComponent c) {
    if (c.isOpaque()) {
        g.setColor(new ColorUIResource(251, 248, 241));
        g.fillRect(0, 0, c.getWidth(), c.getHeight());
        g.setColor(new ColorUIResource(251, 248, 241));
        g.fillRect(0, getRoundHeight(), c.getWidth(), c.getHeight() - getRoundHeight());
    }
    paint(g, c);
}
Also used : ColorUIResource(javax.swing.plaf.ColorUIResource)

Example 23 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project adempiere by adempiere.

the class Info method jbInit.

/**
	 *	Static Init
	 *  @throws Exception
	 */
protected void jbInit() throws Exception {
    this.getContentPane().add(parameterPanel, BorderLayout.NORTH);
    this.getContentPane().add(scrollPane, BorderLayout.CENTER);
    this.getContentPane().add(southPanel, BorderLayout.SOUTH);
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    //
    AppsAction aa = new AppsAction(ConfirmPanel.A_RESET, null, "reset");
    bReset = (CButton) aa.getButton();
    bReset.setMargin(ConfirmPanel.s_insets);
    bReset.setSize(bReset.getHeight(), bReset.getHeight());
    Dimension bSize = bReset.getSize();
    bSize.height = bReset.getHeight();
    bSize.width = bReset.getHeight();
    // Make it square
    bReset.setMaximumSize(bSize);
    bReset.addActionListener(this);
    //
    buttonPanel = new CPanel(new FlowLayout(FlowLayout.LEFT));
    buttonPanel.add(bReset, FlowLayout.LEFT);
    //
    // p_criteriaGrid is filled by the subordinate class
    p_criteriaGrid.setLayout(new ALayout());
    //
    parameterPanel.setLayout(new BorderLayout());
    parameterPanel.add(buttonPanel, BorderLayout.WEST);
    parameterPanel.add(p_criteriaGrid, BorderLayout.CENTER);
    //
    // Setup the detail panel if used
    p_detailTaskPane.setVisible(false);
    p_detailTaskPane.setCollapsed(true);
    p_detailTaskPane.setLayout(new BorderLayout());
    p_detailTaskPane.setUI(new AdempiereTaskPaneUI());
    p_detailTaskPane.getContentPane().setBackground(new ColorUIResource(251, 248, 241));
    p_detailTaskPane.getContentPane().setForeground(new ColorUIResource(251, 0, 0));
    addonPanel.setLayout(new BorderLayout());
    // Allow auto resizing of the panel
    addonPanel.add(p_detailTaskPane, BorderLayout.CENTER);
    southPanel.setLayout(southLayout);
    southPanel.add(addonPanel, BorderLayout.NORTH);
    southPanel.add(confirmPanel, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);
    scrollPane.getViewport().add(p_table, null);
    //
    confirmPanel.addActionListener(this);
    confirmPanel.getResetButton().setVisible(hasReset());
    confirmPanel.getCustomizeButton().setVisible(hasCustomize());
    confirmPanel.getHistoryButton().setVisible(hasHistory());
    confirmPanel.getZoomButton().setVisible(hasZoom());
    //  Only show the OK button if we intend to save
    confirmPanel.setOKVisible(p_saveResults);
    //
    JButton print = ConfirmPanel.createPrintButton(true);
    print.addActionListener(this);
    confirmPanel.addButton(print);
    //
    checkAutoQuery.setText(Msg.getMsg(Env.getCtx(), "AutoRefresh"));
    checkAutoQuery.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoRefresh"));
    checkAutoQuery.setName("AutoQuery");
    checkAutoQuery.setSelected(MSysConfig.getValue(SYSCONFIG_INFO_AUTO_QUERY, "Y", Env.getAD_Client_ID(Env.getCtx())).equals("Y"));
    checkAutoQuery.addActionListener(this);
    // Index 0 is OK-Cancel on the right
    CPanel leftButtons = (CPanel) confirmPanel.getComponent(1);
    // Add the check box on the very left before the refresh icon
    leftButtons.add(checkAutoQuery, 0);
    //
    popup.add(zoomMenu);
    zoomMenu.setText(Msg.getMsg(Env.getCtx(), "Zoom"));
    zoomMenu.setIcon(new ImageIcon(org.compiere.Adempiere.class.getResource("images/Zoom16.gif")));
    zoomMenu.addActionListener(this);
    //
    popup.add(calcMenu);
    calcMenu.setText(Msg.getMsg(Env.getCtx(), "Calculator"));
    calcMenu.setIcon(new ImageIcon(org.compiere.Adempiere.class.getResource("images/Calculator16.gif")));
    calcMenu.addActionListener(this);
    //
    //  Table Selection (Invoked before setting column class so that row selection is enabled)
    p_table.setKeyColumnIndex(-1);
    p_table.setCellSelectionEnabled(false);
    p_table.setColumnSelectionAllowed(false);
    p_table.setRowSelectionAllowed(true);
    //  Override the Enter key input and action map
    if (p_saveResults) {
        p_table.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "doDispose");
    } else {
        p_table.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "doNothing");
    }
    p_table.getActionMap().put("doDispose", doDispose);
    // To enable buttons
    ((ListSelectionModel) p_table.getSelectionModel()).addListSelectionListener(this);
    p_table.addMouseListener(this);
    // Listen to changes in the table
    p_table.addPropertyChangeListener("p_table_update", this);
    ((ListSelectionModel) p_table.getSelectionModel()).addListSelectionListener(this);
    //
    //  Set default location where focus will go. See property change listener.
    m_parentPanel = p_criteriaGrid;
    //
    enableButtons();
}
Also used : AdempiereTaskPaneUI(org.adempiere.plaf.AdempiereTaskPaneUI) ImageIcon(javax.swing.ImageIcon) AppsAction(org.compiere.apps.AppsAction) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) CPanel(org.compiere.swing.CPanel) JButton(javax.swing.JButton) ListSelectionModel(javax.swing.ListSelectionModel) Dimension(java.awt.Dimension) ColorUIResource(javax.swing.plaf.ColorUIResource) ALayout(org.compiere.apps.ALayout)

Example 24 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project jdk8u_jdk by JetBrains.

the class PropertiesMetalTheme method parseColor.

/**
     * parse a comma delimited list of 3 strings into a Color
     */
private ColorUIResource parseColor(String s) {
    int red = 0;
    int green = 0;
    int blue = 0;
    try {
        StringTokenizer st = new StringTokenizer(s, ",");
        red = Integer.parseInt(st.nextToken());
        green = Integer.parseInt(st.nextToken());
        blue = Integer.parseInt(st.nextToken());
    } catch (Exception e) {
        System.out.println(e);
        System.out.println("Couldn't parse color :" + s);
    }
    return new ColorUIResource(red, green, blue);
}
Also used : StringTokenizer(java.util.StringTokenizer) ColorUIResource(javax.swing.plaf.ColorUIResource) IOException(java.io.IOException)

Example 25 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project jdk8u_jdk by JetBrains.

the class ColorCustomizationTest method testNames.

void testNames() {
    Color defaultColor = label.getBackground();
    UIManager.put("\"BlueLabel\"[Enabled].background", new ColorUIResource(Color.BLUE));
    UIManager.put("\"RedLabel\"[Enabled].background", new ColorUIResource(Color.RED));
    nimbus.register(Region.LABEL, "\"BlueLabel\"");
    nimbus.register(Region.LABEL, "\"RedLabel\"");
    label.setName("BlueLabel");
    check(Color.BLUE);
    label.setName("RedLabel");
    check(Color.RED);
    // remove name, color goes back to default
    label.setName(null);
    check(defaultColor);
}
Also used : Color(java.awt.Color) ColorUIResource(javax.swing.plaf.ColorUIResource)

Aggregations

ColorUIResource (javax.swing.plaf.ColorUIResource)36 Color (java.awt.Color)9 FontUIResource (javax.swing.plaf.FontUIResource)4 Dimension (java.awt.Dimension)3 UIDefaults (javax.swing.UIDefaults)3 BorderLayout (java.awt.BorderLayout)2 Insets (java.awt.Insets)2 MouseEvent (java.awt.event.MouseEvent)2 IOException (java.io.IOException)2 StringTokenizer (java.util.StringTokenizer)2 ImageIcon (javax.swing.ImageIcon)2 JScrollPane (javax.swing.JScrollPane)2 Border (javax.swing.border.Border)2 InsetsUIResource (javax.swing.plaf.InsetsUIResource)2 TableCellRenderer (javax.swing.table.TableCellRenderer)2 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)2 ColumnInfo (org.compiere.minigrid.ColumnInfo)2 DarculaButtonPainter (com.intellij.ide.ui.laf.darcula.ui.DarculaButtonPainter)1 DarculaButtonUI (com.intellij.ide.ui.laf.darcula.ui.DarculaButtonUI)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1