Search in sources :

Example 11 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project omegat by omegat-org.

the class DockingUI method ensureTitlebarReadability.

private static void ensureTitlebarReadability() {
    // to ensure DockViewTitleBar title readability
    Color textColor = UIManager.getColor("InternalFrame.inactiveTitleForeground");
    Color backColor = UIManager.getColor("Panel.background");
    if (textColor != null && backColor != null) {
        // One of these could be null
        if (textColor.equals(backColor)) {
            float[] hsb = Color.RGBtoHSB(textColor.getRed(), textColor.getGreen(), textColor.getBlue(), null);
            // darkest 0.0f <--> 1.0f brightest
            float brightness = hsb[2];
            if (brightness >= 0.5f) {
                // to darker
                brightness -= 0.5f;
            } else {
                // to brighter
                brightness += 0.5f;
            }
            int rgb = Color.HSBtoRGB(hsb[0], hsb[1], brightness);
            ColorUIResource res = new ColorUIResource(rgb);
            UIManager.put("InternalFrame.inactiveTitleForeground", res);
        }
    }
    UIManager.put("DockingDesktop.notificationBlinkCount", 2);
    UIManager.put("DockingDesktop.notificationColor", Styles.EditorColor.COLOR_NOTIFICATION_MAX.getColor());
}
Also used : Color(java.awt.Color) ColorUIResource(javax.swing.plaf.ColorUIResource)

Example 12 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project blue by kunstmusik.

the class BlueTableBorder method initComponentDefaults.

@Override
protected void initComponentDefaults(UIDefaults table) {
    super.initComponentDefaults(table);
    Object[] defaults = { "CheckBox.icon", BlueIconFactory.getCheckBoxIcon(), "RadioButton.icon", BlueIconFactory.getRadioButtonIcon(), "Table.gridColor", new javax.swing.plaf.ColorUIResource(getCurrentTheme().getControl()), "SplitPane.highlight", table.getColor("controlShadow"), "SplitPane.darkShadow", table.getColor("window"), "SplitPane.dividerSize", new Integer(5), "Table.cellNoFocusBorder", new EmptyBorder(7, 3, 7, 3), "Table.focusSelectedCellHighlightBorder", BorderFactory.createCompoundBorder(new LineBorder(getCurrentTheme().getFocusColor()), new EmptyBorder(6, 2, 6, 2)), "Table.focusCellHighlightBorder", new EmptyBorder(7, 3, 7, 3), "TableHeader.cellBorder", new BlueTableBorder(), "ToolTip.foreground", new ColorUIResource(Color.black), "Button.border", BlueBorderUtilities.getButtonBorder(), // "Button.border", new BorderUIResource.CompoundBorderUIResource(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), new BasicBorders.MarginBorder()),
    "ToggleButton.border", BlueBorderUtilities.getToggleButtonBorder(), "TextField.border", BlueBorderUtilities.getTextFieldBorder(), "TableHeader.cellBorder", new BlueTableHeaderBorder(), "SplitPane.dividerSize", new Integer(6), "ScrollPane.border", BorderFactory.createLineBorder(getCurrentTheme().getControl()), "ScrollPane.viewportBorder", null, "ScrollBar.width", 14, "ScrollBar.background", getCurrentTheme().getControl().darker(), "ScrollBar.shadow", getCurrentTheme().getControl().darker(), "ScrollBar.darkShadow", getCurrentTheme().getControl().darker(), "Slider.horizontalThumbIcon", BlueIconFactory.getHorizontalSliderThumbIcon(), "Slider.verticalThumbIcon", BlueIconFactory.getVerticalSliderThumbIcon(), "Spinner.border", BlueBorderUtilities.getTextFieldBorder(), "Spinner.arrowButtonBorder", BlueBorderUtilities.getButtonBorder(), "Spinner.background", Color.BLACK };
    table.putDefaults(defaults);
// table.put("Menu.font", new FontUIResource("Dialog", Font.PLAIN, 12));
// table.put("MenuItem.font", new FontUIResource("Dialog", Font.PLAIN,
// 12));
// String osName = System.getProperty("os.name");
// 
// if (osName.toLowerCase().indexOf("mac") >= 0) {
// 
// Enumeration keys = table.keys();
// 
// ArrayList inputMapKeys = new ArrayList();
// 
// while (keys.hasMoreElements()) {
// String key = keys.nextElement().toString();
// 
// if (key.indexOf("InputMap") >= 0) {
// inputMapKeys.add(key);
// }
// }
// 
// for (int i = 0; i < inputMapKeys.size(); i++) {
// Object obj = table.get(inputMapKeys.get(i));
// 
// if (obj instanceof InputMapUIResource) {
// InputMapUIResource inputMap = (InputMapUIResource) obj;
// 
// setupForOSX(inputMap);
// }
// }
// 
// }
}
Also used : LineBorder(javax.swing.border.LineBorder) ColorUIResource(javax.swing.plaf.ColorUIResource) EmptyBorder(javax.swing.border.EmptyBorder) ColorUIResource(javax.swing.plaf.ColorUIResource)

Example 13 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project Botnak by Gocnak.

the class AbstractLookAndFeel method initComponentDefaults.

protected void initComponentDefaults(UIDefaults table) {
    super.initComponentDefaults(table);
    BaseBorders.initDefaults();
    BaseIcons.initDefaults();
    Object textFieldBorder = getBorderFactory().getTextFieldBorder();
    Object comboBoxBorder = getBorderFactory().getComboBoxBorder();
    Object scrollPaneBorder = getBorderFactory().getScrollPaneBorder();
    Object tableScrollPaneBorder = getBorderFactory().getTableScrollPaneBorder();
    Object tabbedPaneBorder = getBorderFactory().getTabbedPaneBorder();
    Object buttonBorder = getBorderFactory().getButtonBorder();
    Object toggleButtonBorder = getBorderFactory().getToggleButtonBorder();
    Object titledBorderBorder = new UIDefaults.ProxyLazyValue("javax.swing.plaf.BorderUIResource$LineBorderUIResource", new Object[] { getFrameColor() });
    Object menuBarBorder = getBorderFactory().getMenuBarBorder();
    Object popupMenuBorder = getBorderFactory().getPopupMenuBorder();
    Object menuItemBorder = getBorderFactory().getMenuItemBorder();
    Object toolBarBorder = getBorderFactory().getToolBarBorder();
    Object progressBarBorder = getBorderFactory().getProgressBarBorder();
    Object toolTipBorder = new UIDefaults.ProxyLazyValue("javax.swing.plaf.BorderUIResource$LineBorderUIResource", new Object[] { getFrameColor() });
    Object focusCellHighlightBorder = new UIDefaults.ProxyLazyValue("javax.swing.plaf.BorderUIResource$LineBorderUIResource", new Object[] { getFocusCellColor() });
    Object optionPaneBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
    Object optionPaneMessageAreaBorder = BorderFactory.createEmptyBorder(8, 8, 8, 8);
    Object optionPaneButtonAreaBorder = BorderFactory.createEmptyBorder(0, 8, 8, 8);
    Object windowBorder = getBorderFactory().getInternalFrameBorder();
    Color c = getBackgroundColor();
    ColorUIResource progressBarBackground = new ColorUIResource(ColorHelper.brighter(c, 20));
    // DEFAULTS TABLE
    Object[] defaults = { "controlTextFont", getControlTextFont(), "systemTextFont ", getSystemTextFont(), "userTextFont", getUserTextFont(), "menuTextFont", getMenuTextFont(), "windowTitleFont", getWindowTitleFont(), "subTextFont", getSubTextFont(), "Label.font", getUserTextFont(), "Label.background", getBackgroundColor(), "Label.foreground", getForegroundColor(), "Label.disabledText", getDisabledForegroundColor(), "Label.disabledShadow", getWhite(), // Text (Note: many are inherited)
    "TextField.border", textFieldBorder, "TextField.foreground", getInputForegroundColor(), "TextField.background", getInputBackgroundColor(), "TextField.disabledForeground", getDisabledForegroundColor(), "TextField.disabledBackground", getDisabledBackgroundColor(), "TextField.inactiveForeground", getDisabledForegroundColor(), "TextField.inactiveBackground", getDisabledBackgroundColor(), "TextArea.foreground", getInputForegroundColor(), "TextArea.background", getInputBackgroundColor(), "TextArea.disabledForeground", getDisabledForegroundColor(), "TextArea.disabledBackground", getDisabledBackgroundColor(), "TextArea.inactiveForeground", getDisabledForegroundColor(), "TextArea.inactiveBackground", getDisabledBackgroundColor(), "EditorPane.foreground", getInputForegroundColor(), "EditorPane.background", getInputBackgroundColor(), "EditorPane.disabledForeground", getDisabledForegroundColor(), "EditorPane.disabledBackground", getDisabledBackgroundColor(), "EditorPane.inactiveForeground", getDisabledForegroundColor(), "EditorPane.inactiveBackground", getDisabledBackgroundColor(), "FormattedTextField.border", textFieldBorder, "FormattedTextField.foreground", getInputForegroundColor(), "FormattedTextField.background", getInputBackgroundColor(), "FormattedTextField.disabledForeground", getDisabledForegroundColor(), "FormattedTextField.disabledBackground", getDisabledBackgroundColor(), "FormattedTextField.inactiveForeground", getDisabledForegroundColor(), "FormattedTextField.inactiveBackground", getDisabledBackgroundColor(), "PasswordField.border", textFieldBorder, "PasswordField.foreground", getInputForegroundColor(), "PasswordField.background", getInputBackgroundColor(), "PasswordField.disabledForeground", getDisabledForegroundColor(), "PasswordField.disabledBackground", getDisabledBackgroundColor(), "PasswordField.inactiveForeground", getDisabledForegroundColor(), "PasswordField.inactiveBackground", getDisabledBackgroundColor(), // Buttons
    "Button.background", getButtonBackgroundColor(), "Button.foreground", getButtonForegroundColor(), "Button.disabledText", getDisabledForegroundColor(), "Button.disabledShadow", getWhite(), "Button.select", getSelectionBackgroundColor(), "Button.border", buttonBorder, "Button.frame", getFrameColor(), "Button.focus", getFocusColor(), "Button.rolloverColor", getTheme().getRolloverColor(), "CheckBox.font", getUserTextFont(), "CheckBox.background", getBackgroundColor(), "CheckBox.foreground", getForegroundColor(), "CheckBox.disabledText", getDisabledForegroundColor(), "CheckBox.disabledShadow", getWhite(), "Checkbox.select", getSelectionBackgroundColor(), "CheckBox.focus", getFocusColor(), "CheckBox.icon", getIconFactory().getCheckBoxIcon(), "RadioButton.font", getUserTextFont(), "RadioButton.background", getBackgroundColor(), "RadioButton.foreground", getForegroundColor(), "RadioButton.disabledText", getDisabledForegroundColor(), "RadioButton.disabledShadow", getWhite(), "RadioButton.select", getSelectionBackgroundColor(), "RadioButton.icon", getIconFactory().getRadioButtonIcon(), "RadioButton.focus", getFocusColor(), "ToggleButton.background", getButtonBackgroundColor(), "ToggleButton.foreground", getButtonForegroundColor(), "ToggleButton.select", getSelectionBackgroundColor(), "ToggleButton.text", getButtonForegroundColor(), "ToggleButton.disabledText", getDisabledForegroundColor(), "ToggleButton.disabledShadow", getWhite(), "ToggleButton.disabledSelectedText", getDisabledForegroundColor(), "ToggleButton.disabledBackground", getButtonBackgroundColor(), "ToggleButton.disabledSelectedBackground", getSelectionBackgroundColor(), "ToggleButton.focus", getFocusColor(), "ToggleButton.border", toggleButtonBorder, // ToolTip
    "ToolTip.border", toolTipBorder, "ToolTip.foreground", getTooltipForegroundColor(), "ToolTip.background", getTooltipBackgroundColor(), // Slider
    "Slider.border", null, "Slider.foreground", getFrameColor(), "Slider.background", getBackgroundColor(), "Slider.focus", getFocusColor(), "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0), "Slider.trackWidth", 7, "Slider.majorTickLength", 6, // Progress Bar
    "ProgressBar.border", progressBarBorder, "ProgressBar.background", progressBarBackground, "ProgressBar.selectionForeground", getSelectionForegroundColor(), "ProgressBar.selectionBackground", getForegroundColor(), // Combo Box
    "ComboBox.border", comboBoxBorder, "ComboBox.background", getInputBackgroundColor(), "ComboBox.foreground", getInputForegroundColor(), "ComboBox.selectionBackground", getSelectionBackgroundColor(), "ComboBox.selectionForeground", getSelectionForegroundColor(), "ComboBox.selectionBorderColor", getFocusColor(), "ComboBox.disabledBackground", getDisabledBackgroundColor(), "ComboBox.disabledForeground", getDisabledForegroundColor(), "ComboBox.listBackground", getInputBackgroundColor(), "ComboBox.listForeground", getInputForegroundColor(), "ComboBox.font", getUserTextFont(), // Panel
    "Panel.foreground", getForegroundColor(), "Panel.background", getBackgroundColor(), "Panel.darkBackground", getTheme().getBackgroundColorDark(), "Panel.lightBackground", getTheme().getBackgroundColorLight(), "Panel.alterBackground", getTheme().getAlterBackgroundColor(), "Panel.font", getUserTextFont(), // RootPane
    "RootPane.frameBorder", windowBorder, "RootPane.plainDialogBorder", windowBorder, "RootPane.informationDialogBorder", windowBorder, "RootPane.errorDialogBorder", windowBorder, "RootPane.colorChooserDialogBorder", windowBorder, "RootPane.fileChooserDialogBorder", windowBorder, "RootPane.questionDialogBorder", windowBorder, "RootPane.warningDialogBorder", windowBorder, // InternalFrame
    "InternalFrame.border", getBorderFactory().getInternalFrameBorder(), "InternalFrame.font", getWindowTitleFont(), "InternalFrame.paletteBorder", getBorderFactory().getPaletteBorder(), "InternalFrame.paletteTitleHeight", 11, "InternalFrame.paletteCloseIcon", getIconFactory().getPaletteCloseIcon(), "InternalFrame.icon", getIconFactory().getMenuIcon(), "InternalFrame.iconifyIcon", getIconFactory().getIconIcon(), "InternalFrame.maximizeIcon", getIconFactory().getMaxIcon(), "InternalFrame.minimizeIcon", getIconFactory().getMinIcon(), "InternalFrame.closeIcon", getIconFactory().getCloseIcon(), // Titled Border
    "TitledBorder.titleColor", getForegroundColor(), "TitledBorder.border", titledBorderBorder, // List
    "List.focusCellHighlightBorder", focusCellHighlightBorder, "List.font", getUserTextFont(), "List.foreground", getInputForegroundColor(), "List.background", getInputBackgroundColor(), "List.selectionForeground", getSelectionForegroundColor(), "List.selectionBackground", getSelectionBackgroundColor(), "List.disabledForeground", getDisabledForegroundColor(), "List.disabledBackground", getDisabledBackgroundColor(), // ScrollBar
    "ScrollBar.background", getControlBackgroundColor(), "ScrollBar.highlight", getControlHighlightColor(), "ScrollBar.shadow", getControlShadowColor(), "ScrollBar.darkShadow", getControlDarkShadowColor(), "ScrollBar.thumb", getControlBackgroundColor(), "ScrollBar.thumbShadow", getControlShadowColor(), "ScrollBar.thumbHighlight", getControlHighlightColor(), "ScrollBar.width", 17, "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE, // ScrollPane
    "ScrollPane.border", scrollPaneBorder, "ScrollPane.foreground", getForegroundColor(), "ScrollPane.background", getBackgroundColor(), // Viewport
    "Viewport.foreground", getForegroundColor(), "Viewport.background", getBackgroundColor(), "Viewport.font", getUserTextFont(), // Tabbed Pane
    "TabbedPane.boder", tabbedPaneBorder, "TabbedPane.background", getBackgroundColor(), "TabbedPane.tabAreaBackground", getTabAreaBackgroundColor(), "TabbedPane.unselectedBackground", getControlColorDark(), "TabbedPane.foreground", getControlForegroundColor(), "TabbedPane.selected", getBackgroundColor(), "TabbedPane.selectedForeground", getTabSelectionForegroundColor(), "TabbedPane.tabAreaInsets", new InsetsUIResource(5, 5, 5, 5), "TabbedPane.contentBorderInsets", new InsetsUIResource(0, 0, 0, 0), "TabbedPane.tabInsets", new InsetsUIResource(1, 6, 1, 6), "TabbedPane.focus", getFocusColor(), // TabbedPane ScrollButton
    "TabbedPane.selected", getButtonBackgroundColor(), "TabbedPane.shadow", new ColorUIResource(180, 180, 180), "TabbedPane.darkShadow", new ColorUIResource(120, 120, 120), "TabbedPane.highlight", new ColorUIResource(Color.white), // Tab Colors in Netbeans
    "tab_unsel_fill", getControlBackgroundColor(), "tab_sel_fill", getControlBackgroundColor(), // Table
    "Table.focusCellHighlightBorder", focusCellHighlightBorder, "Table.scrollPaneBorder", tableScrollPaneBorder, "Table.foreground", getInputForegroundColor(), "Table.background", getInputBackgroundColor(), "Table.gridColor", getGridColor(), "TableHeader.foreground", getControlForegroundColor(), "TableHeader.background", getBackgroundColor(), "TableHeader.cellBorder", getBorderFactory().getTableHeaderBorder(), // MenuBar
    "MenuBar.border", menuBarBorder, "MenuBar.foreground", getMenuForegroundColor(), "MenuBar.background", getMenuBackgroundColor(), // Menu
    "Menu.border", menuItemBorder, "Menu.borderPainted", Boolean.TRUE, "Menu.foreground", getMenuForegroundColor(), "Menu.background", getMenuBackgroundColor(), "Menu.selectionForeground", getMenuSelectionForegroundColor(), "Menu.selectionBackground", getMenuSelectionBackgroundColor(), "Menu.disabledForeground", getDisabledForegroundColor(), "Menu.acceleratorForeground", getMenuForegroundColor(), "Menu.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "Menu.arrowIcon", getIconFactory().getMenuArrowIcon(), // Popup Menu
    "PopupMenu.background", getMenuBackgroundColor(), "PopupMenu.border", popupMenuBorder, // Menu Item
    "MenuItem.border", menuItemBorder, "MenuItem.borderPainted", Boolean.TRUE, "MenuItem.foreground", getMenuForegroundColor(), "MenuItem.background", getMenuBackgroundColor(), "MenuItem.selectionForeground", getMenuSelectionForegroundColor(), "MenuItem.selectionBackground", getMenuSelectionBackgroundColor(), "MenuItem.disabledForeground", getDisabledForegroundColor(), "MenuItem.disabledShadow", getWhite(), "MenuItem.acceleratorForeground", getMenuForegroundColor(), "MenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "CheckBoxMenuItem.border", menuItemBorder, "CheckBoxMenuItem.borderPainted", Boolean.TRUE, "CheckBoxMenuItem.foreground", getMenuForegroundColor(), "CheckBoxMenuItem.background", getMenuBackgroundColor(), "CheckBoxMenuItem.selectionForeground", getMenuSelectionForegroundColor(), "CheckBoxMenuItem.selectionBackground", getMenuSelectionBackgroundColor(), "CheckBoxMenuItem.disabledForeground", getDisabledForegroundColor(), "CheckBoxMenuItem.disabledShadow", getWhite(), "CheckBoxMenuItem.acceleratorForeground", getMenuForegroundColor(), "CheckBoxMenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "CheckBoxMenuItem.checkIcon", getIconFactory().getMenuCheckBoxIcon(), "RadioButtonMenuItem.border", menuItemBorder, "RadioButtonMenuItem.borderPainted", Boolean.TRUE, "RadioButtonMenuItem.foreground", getMenuForegroundColor(), "RadioButtonMenuItem.background", getMenuBackgroundColor(), "RadioButtonMenuItem.selectionForeground", getMenuSelectionForegroundColor(), "RadioButtonMenuItem.selectionBackground", getMenuSelectionBackgroundColor(), "RadioButtonMenuItem.disabledForeground", getDisabledForegroundColor(), "RadioButtonMenuItem.disabledShadow", getWhite(), "RadioButtonMenuItem.acceleratorForeground", getMenuForegroundColor(), "RadioButtonMenuItem.acceleratorSelectionForeground", getMenuSelectionForegroundColor(), "RadioButtonMenuItem.checkIcon", getIconFactory().getMenuRadioButtonIcon(), // OptionPane.
    "OptionPane.errorIcon", getIconFactory().getOptionPaneErrorIcon(), "OptionPane.informationIcon", getIconFactory().getOptionPaneInformationIcon(), "OptionPane.warningIcon", getIconFactory().getOptionPaneWarningIcon(), "OptionPane.questionIcon", getIconFactory().getOptionPaneQuestionIcon(), "OptionPane.border", optionPaneBorder, "OptionPane.messageAreaBorder", optionPaneMessageAreaBorder, "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder, // File View
    "FileView.directoryIcon", getIconFactory().getTreeFolderIcon(), "FileView.fileIcon", getIconFactory().getTreeLeafIcon(), "FileView.computerIcon", getIconFactory().getTreeComputerIcon(), "FileView.hardDriveIcon", getIconFactory().getTreeHardDriveIcon(), "FileView.floppyDriveIcon", getIconFactory().getTreeFloppyDriveIcon(), // File Chooser
    "FileChooser.detailsViewIcon", getIconFactory().getFileChooserDetailViewIcon(), "FileChooser.homeFolderIcon", getIconFactory().getFileChooserHomeFolderIcon(), "FileChooser.listViewIcon", getIconFactory().getFileChooserListViewIcon(), "FileChooser.newFolderIcon", getIconFactory().getFileChooserNewFolderIcon(), "FileChooser.upFolderIcon", getIconFactory().getFileChooserUpFolderIcon(), // Separator
    "Separator.background", getBackgroundColor(), "Separator.foreground", getControlForegroundColor(), // SplitPane
    "SplitPane.centerOneTouchButtons", Boolean.TRUE, "SplitPane.dividerSize", 7, "SplitPane.border", BorderFactory.createEmptyBorder(), // Tree
    "Tree.background", getInputBackgroundColor(), "Tree.foreground", getInputForegroundColor(), "Tree.textForeground", getInputForegroundColor(), "Tree.textBackground", getInputBackgroundColor(), "Tree.openIcon", new ImageIcon(), /*getIconFactory().getTreeFolderIcon()*/
    "Tree.closedIcon", new ImageIcon(), /*getIconFactory().getTreeFolderIcon()*/
    "Tree.leafIcon", new ImageIcon(), /*getIconFactory().getTreeLeafIcon()*/
    "Tree.expandedIcon", getIconFactory().getTreeExpandedIcon(), "Tree.collapsedIcon", getIconFactory().getTreeCollapsedIcon(), "Tree.selectionBorderColor", getFocusCellColor(), // horiz lines
    "Tree.line", // horiz lines
    getFrameColor(), // legs
    "Tree.hash", // legs
    getFrameColor(), // ToolBar
    "JToolBar.isRollover", Boolean.TRUE, "ToolBar.border", toolBarBorder, "ToolBar.background", getToolbarBackgroundColor(), "ToolBar.foreground", getToolbarForegroundColor(), "ToolBar.dockingBackground", getToolbarBackgroundColor(), "ToolBar.dockingForeground", getToolbarDockingColor(), "ToolBar.floatingBackground", getToolbarBackgroundColor(), "ToolBar.floatingForeground", getToolbarForegroundColor() };
    table.putDefaults(defaults);
    if (JTattooUtilities.getJavaVersion() >= 1.5) {
        table.put("Spinner.font", getControlTextFont());
        table.put("Spinner.background", getButtonBackgroundColor());
        table.put("Spinner.foreground", getButtonForegroundColor());
        table.put("Spinner.border", getBorderFactory().getSpinnerBorder());
        table.put("Spinner.arrowButtonInsets", null);
        table.put("Spinner.arrowButtonBorder", BorderFactory.createEmptyBorder());
        table.put("Spinner.editorBorderPainted", Boolean.FALSE);
    }
}
Also used : InsetsUIResource(javax.swing.plaf.InsetsUIResource) ColorUIResource(javax.swing.plaf.ColorUIResource)

Example 14 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project lar_361 by comitsrl.

the class InfoProduct method statInit.

/**
 *	Static Setup - add fields to parameterPanel
 */
private void statInit() {
    labelValue.setText(Msg.getMsg(Env.getCtx(), "Value"));
    fieldValue.setBackground(AdempierePLAF.getInfoBackground());
    fieldValue.addActionListener(this);
    labelName.setText(Msg.getMsg(Env.getCtx(), "Name"));
    fieldName.setBackground(AdempierePLAF.getInfoBackground());
    fieldName.addActionListener(this);
    labelUPC.setText(Msg.translate(Env.getCtx(), "UPC"));
    fieldUPC.setBackground(AdempierePLAF.getInfoBackground());
    fieldUPC.addActionListener(this);
    labelSKU.setText(Msg.translate(Env.getCtx(), "SKU"));
    fieldSKU.setBackground(AdempierePLAF.getInfoBackground());
    fieldSKU.addActionListener(this);
    labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse"));
    pickWarehouse.setBackground(AdempierePLAF.getInfoBackground());
    labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
    pickPriceList.setBackground(AdempierePLAF.getInfoBackground());
    labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
    pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());
    // @Trifon
    labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
    pickAS.setBackground(AdempierePLAF.getInfoBackground());
    m_InfoPAttributeButton.setMargin(new Insets(2, 2, 2, 2));
    m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
    m_InfoPAttributeButton.addActionListener(this);
    labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
    fieldVendor.setBackground(AdempierePLAF.getInfoBackground());
    fieldVendor.addActionListener(this);
    // Line 1
    parameterPanel.setLayout(new ALayout());
    parameterPanel.add(labelValue, new ALayoutConstraint(0, 0));
    parameterPanel.add(fieldValue, null);
    parameterPanel.add(labelUPC, null);
    parameterPanel.add(fieldUPC, null);
    parameterPanel.add(labelWarehouse, null);
    parameterPanel.add(pickWarehouse, null);
    parameterPanel.add(m_InfoPAttributeButton);
    // Line 2
    parameterPanel.add(labelName, new ALayoutConstraint(1, 0));
    parameterPanel.add(fieldName, null);
    parameterPanel.add(labelSKU, null);
    parameterPanel.add(fieldSKU, null);
    parameterPanel.add(labelVendor, null);
    parameterPanel.add(fieldVendor, null);
    // Line 3
    parameterPanel.add(labelPriceList, new ALayoutConstraint(2, 0));
    parameterPanel.add(pickPriceList, null);
    parameterPanel.add(labelProductCategory, null);
    parameterPanel.add(pickProductCategory, null);
    // @Trifon
    parameterPanel.add(labelAS, null);
    // @Trifon
    parameterPanel.add(pickAS, null);
    // Product Attribute Instance
    m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
    confirmPanel.addButton(m_PAttributeButton);
    m_PAttributeButton.addActionListener(this);
    m_PAttributeButton.setEnabled(false);
    // Begin - fer_luck @ centuryon
    // add taskpane
    fieldDescription.setBackground(AdempierePLAF.getInfoBackground());
    fieldDescription.setEditable(false);
    fieldDescription.setPreferredSize(new Dimension(INFO_WIDTH - 100, 100));
    warehouseStockPanel.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock"));
    warehouseStockPanel.setUI(new AdempiereTaskPaneUI());
    warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251, 248, 241));
    warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251, 0, 0));
    ColumnInfo[] s_layoutWarehouse = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class) };
    /**
     *	From Clause
     */
    String s_sqlFrom = " M_PRODUCT_STOCK_V ";
    /**
     * Where Clause
     */
    String s_sqlWhere = "Value = ?";
    m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
    m_sqlWarehouse += " Group By Warehouse, documentnote ";
    warehouseTbl.setRowSelectionAllowed(true);
    warehouseTbl.setMultiSelection(false);
    warehouseTbl.addMouseListener(this);
    warehouseTbl.getSelectionModel().addListSelectionListener(this);
    warehouseTbl.setShowTotals(true);
    warehouseTbl.autoSize();
    ColumnInfo[] s_layoutSubstitute = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
    m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    substituteTbl.setRowSelectionAllowed(false);
    substituteTbl.setMultiSelection(false);
    substituteTbl.addMouseListener(this);
    substituteTbl.getSelectionModel().addListSelectionListener(this);
    substituteTbl.autoSize();
    ColumnInfo[] s_layoutRelated = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
    m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    relatedTbl.setRowSelectionAllowed(false);
    relatedTbl.setMultiSelection(false);
    relatedTbl.addMouseListener(this);
    relatedTbl.getSelectionModel().addListSelectionListener(this);
    relatedTbl.autoSize();
    // Available to Promise Tab
    m_tableAtp.setRowSelectionAllowed(false);
    m_tableAtp.setMultiSelection(false);
    CTabbedPane jTab = new CTabbedPane();
    jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
    jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
    jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription));
    jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl));
    jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl));
    jTab.addTab(Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
    jTab.addChangeListener(this);
    tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
    tablePanel.add(jTab);
    warehouseStockPanel.setCollapsed(true);
    warehouseStockPanel.add(tablePanel);
    this.addonPanel.add(warehouseStockPanel);
    this.p_table.addKeyListener(new KeyAdapter() {

        public void keyReleased(KeyEvent ke) {
            int row = ((MiniTable) ke.getSource()).getSelectedRow();
            refresh(((MiniTable) ke.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
        }
    });
    this.p_table.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent me) {
            int row = ((MiniTable) me.getSource()).getSelectedRow();
            refresh(((MiniTable) me.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue());
            warehouseStockPanel.setCollapsed(false);
        }
    });
// End - fer_luck @ centuryon
}
Also used : JScrollPane(javax.swing.JScrollPane) AdempiereTaskPaneUI(org.adempiere.plaf.AdempiereTaskPaneUI) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) KeyAdapter(java.awt.event.KeyAdapter) MouseAdapter(java.awt.event.MouseAdapter) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) ColumnInfo(org.compiere.minigrid.ColumnInfo) Dimension(java.awt.Dimension) ColorUIResource(javax.swing.plaf.ColorUIResource) BigDecimal(java.math.BigDecimal) CTabbedPane(org.compiere.swing.CTabbedPane) MiniTable(org.compiere.minigrid.MiniTable) KeyEvent(java.awt.event.KeyEvent) ALayout(org.compiere.apps.ALayout)

Example 15 with ColorUIResource

use of javax.swing.plaf.ColorUIResource in project Botnak by Gocnak.

the class HiFiDefaultTheme method setUpColor.

public void setUpColor() {
    super.setUpColor();
    // Defaults for HiFiLookAndFeel
    textShadow = true;
    foregroundColor = extraLightGray;
    disabledForegroundColor = gray;
    disabledBackgroundColor = new ColorUIResource(48, 48, 48);
    backgroundColor = new ColorUIResource(48, 48, 48);
    backgroundColorLight = new ColorUIResource(48, 48, 48);
    // was 16, 16, 16, they were the fugly black lines
    backgroundColorDark = new ColorUIResource(48, 48, 48);
    alterBackgroundColor = new ColorUIResource(64, 64, 64);
    selectionForegroundColor = white;
    selectionBackgroundColor = new ColorUIResource(40, 40, 40);
    frameColor = black;
    gridColor = black;
    focusCellColor = orange;
    inputBackgroundColor = new ColorUIResource(80, 80, 80);
    inputForegroundColor = foregroundColor;
    rolloverColor = new ColorUIResource(112, 112, 112);
    rolloverColorLight = new ColorUIResource(128, 128, 128);
    rolloverColorDark = new ColorUIResource(96, 96, 96);
    buttonForegroundColor = foregroundColor;
    buttonBackgroundColor = new ColorUIResource(96, 96, 96);
    buttonColorLight = new ColorUIResource(96, 96, 96);
    buttonColorDark = new ColorUIResource(32, 32, 32);
    controlForegroundColor = foregroundColor;
    // netbeans use this for selected tab in the toolbar
    controlBackgroundColor = new ColorUIResource(64, 64, 64);
    controlColorLight = new ColorUIResource(96, 96, 96);
    controlColorDark = new ColorUIResource(32, 32, 32);
    controlHighlightColor = new ColorUIResource(96, 96, 96);
    controlShadowColor = new ColorUIResource(32, 32, 32);
    controlDarkShadowColor = black;
    windowTitleForegroundColor = foregroundColor;
    windowTitleBackgroundColor = new ColorUIResource(96, 96, 96);
    windowTitleColorLight = new ColorUIResource(96, 96, 96);
    // new ColorUIResource(16, 16, 16);
    windowTitleColorDark = new ColorUIResource(32, 32, 32);
    windowBorderColor = black;
    windowIconColor = lightGray;
    windowIconShadowColor = black;
    windowIconRolloverColor = orange;
    windowInactiveTitleForegroundColor = new ColorUIResource(196, 196, 196);
    windowInactiveTitleBackgroundColor = new ColorUIResource(64, 64, 64);
    windowInactiveTitleColorLight = new ColorUIResource(64, 64, 64);
    windowInactiveTitleColorDark = new ColorUIResource(32, 32, 32);
    windowInactiveBorderColor = black;
    menuForegroundColor = foregroundColor;
    menuBackgroundColor = new ColorUIResource(32, 32, 32);
    menuSelectionForegroundColor = white;
    menuSelectionBackgroundColor = new ColorUIResource(96, 96, 96);
    menuColorLight = new ColorUIResource(96, 96, 96);
    menuColorDark = new ColorUIResource(32, 32, 32);
    toolbarBackgroundColor = new ColorUIResource(48, 48, 48);
    toolbarColorLight = new ColorUIResource(96, 96, 96);
    toolbarColorDark = new ColorUIResource(32, 32, 32);
    tabAreaBackgroundColor = backgroundColor;
    tabSelectionForegroundColor = selectionForegroundColor;
    desktopColor = new ColorUIResource(64, 64, 64);
    tooltipForegroundColor = white;
    tooltipBackgroundColor = new ColorUIResource(24, 24, 24);
    controlFont = new FontUIResource("Dialog", Font.BOLD, 12);
    systemFont = new FontUIResource("Dialog", Font.BOLD, 12);
    userFont = new FontUIResource("Dialog", Font.BOLD, 12);
    menuFont = new FontUIResource("Dialog", Font.BOLD, 12);
    windowTitleFont = new FontUIResource("Dialog", Font.BOLD, 12);
    smallFont = new FontUIResource("Dialog", Font.PLAIN, 10);
}
Also used : FontUIResource(javax.swing.plaf.FontUIResource) 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