Example usage for javax.swing UIManager getColor

List of usage examples for javax.swing UIManager getColor

Introduction

In this page you can find the example usage for javax.swing UIManager getColor.

Prototype

public static Color getColor(Object key) 

Source Link

Document

Returns a color from the defaults.

Usage

From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java

Color getForegroundColor(final JList list, final int index, final boolean isSelected) {
    Color foreground;// w w w  .j a v a 2  s  .  c  om

    // check if this cell represents the current DnD drop location
    final JList.DropLocation dropLocation = list.getDropLocation();
    if (dropLocation != null && !dropLocation.isInsert() && dropLocation.getIndex() == index) {
        foreground = Color.WHITE;
    } else if (isSelected) {
        foreground = UIManager.getColor("Tree.selectionForeground");
    } else {
        foreground = Color.BLACK;
    }
    return foreground;
}

From source file:FileTree3.java

public IconCellRenderer() {
    super();/*from  w  ww. j av a2  s  . com*/
    m_textSelectionColor = UIManager.getColor("Tree.selectionForeground");
    m_textNonSelectionColor = UIManager.getColor("Tree.textForeground");
    m_bkSelectionColor = UIManager.getColor("Tree.selectionBackground");
    m_bkNonSelectionColor = UIManager.getColor("Tree.textBackground");
    m_borderSelectionColor = UIManager.getColor("Tree.selectionBorderColor");
    setOpaque(false);
}

From source file:com.moneydance.modules.features.importlist.util.Preferences.java

public static Color getHeaderForeground() {
    return UIManager.getColor("Label.disabledForeground");
}

From source file:DefaultsDisplay.java

protected JTable createDefaultsTable() {
    JTable table = new JTable(new UIDefaultsTableModel());
    table.setRowHeight(rowHeight);/*w w  w.  j av a2s . com*/
    table.setShowHorizontalLines(false);
    table.setShowVerticalLines(false);
    table.setIntercellSpacing(new Dimension(0, 0));
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    initFilters(table);

    DefaultTableColumnModel columnModel = new DefaultTableColumnModel();

    Color rowColors[] = new Color[2];
    rowColors[0] = UIManager.getColor("Table.background");
    rowColors[1] = new Color((int) (rowColors[0].getRed() * .90), (int) (rowColors[0].getGreen() * .95),
            (int) (rowColors[0].getBlue() * .95));

    int width = 0;

    TableColumn column = new TableColumn();
    column.setCellRenderer(new KeyRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.KEY_COLUMN);
    column.setHeaderValue("Key");
    column.setPreferredWidth(250);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();

    column = new TableColumn();
    column.setCellRenderer(new RowRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.TYPE_COLUMN);
    column.setHeaderValue("Type");
    column.setPreferredWidth(250);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();

    column = new TableColumn();
    column.setCellRenderer(new ValueRenderer(rowColors));
    column.setModelIndex(UIDefaultsTableModel.VALUE_COLUMN);
    column.setHeaderValue("Value");
    column.setPreferredWidth(300);
    columnModel.addColumn(column);
    width += column.getPreferredWidth();

    table.setColumnModel(columnModel);

    table.setPreferredScrollableViewportSize(new Dimension(width, 12 * rowHeight));

    return table;

}

From source file:org.simbrain.plot.histogram.HistogramPanel.java

/**
 * Create the histogram panel based on the data.
 */// w w w.j av  a  2  s .co m
public void createHistogram() {
    try {
        if (this.getModel().getData() != null) {
            mainChart = ChartFactory.createHistogram(title, xAxisName, yAxisName, model.getDataSet(),
                    PlotOrientation.VERTICAL, true, true, false);
            mainChart.setBackgroundPaint(UIManager.getColor("this.Background"));

            XYPlot plot = (XYPlot) mainChart.getPlot();
            plot.setForegroundAlpha(0.75F);
            // Sets y-axis ticks to integers.
            NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
            rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
            XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
            renderer.setDrawBarOutline(false);
            renderer.setShadowVisible(false);

            Iterator<ColoredDataSeries> series = model.getSeriesData().iterator();
            for (int i = 0; i < model.getData().size(); i++) {
                if (i < colorPallet.length) {
                    ColoredDataSeries s = series.next();
                    Color c = s.color;
                    if (c == null) {
                        c = assignColor();
                        s.color = c;
                    }
                    renderer.setSeriesPaint(i, c, true);
                }
            }

        } else {

            mainChart = ChartFactory.createHistogram(title, xAxisName, yAxisName, model.getDataSet(),
                    PlotOrientation.VERTICAL, true, true, false);
            mainChart.setBackgroundPaint(UIManager.getColor("this.Background"));

        }

    } catch (IllegalArgumentException iaEx) {
        iaEx.printStackTrace();
        JOptionPane.showMessageDialog(null, iaEx.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    } catch (IllegalStateException isEx) {
        isEx.printStackTrace();
        JOptionPane.showMessageDialog(null, isEx.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    }
    mainPanel = new ChartPanel(mainChart);

}

From source file:dpcs.About.java

public About() {
    setIconImage(Toolkit.getDefaultToolkit().getImage(About.class.getResource("/graphics/Icon.png")));
    setResizable(false);/*www . j ava  2 s.  co m*/
    setType(Type.UTILITY);
    setTitle("About");
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 540, 400);
    contentPane = new JPanel();
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    try {
        InputStreamReader reader2 = new InputStreamReader(
                getClass().getResourceAsStream("/others/app-version.txt"));
        String tmp = IOUtils.toString(reader2);
        AppVersion = Double.parseDouble(tmp);
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    JButton btnGitHub = new JButton("GitHub");
    btnGitHub.setToolTipText("Access Droid PC Suite github repository");
    btnGitHub.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            try {
                Desktop.getDesktop().browse(new URL("https://github.com/kvsjxd/Droid-PC-Suite/").toURI());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    btnGitHub.setBounds(369, 295, 111, 25);
    contentPane.add(btnGitHub);

    JLabel lblMyFriend4 = new JLabel("Gulati-kun");
    lblMyFriend4.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblMyFriend4.setBounds(25, 266, 242, 24);
    contentPane.add(lblMyFriend4);

    JLabel lblMyFriend3 = new JLabel("Anil-kun");
    lblMyFriend3.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblMyFriend3.setBounds(25, 242, 242, 24);
    contentPane.add(lblMyFriend3);

    JLabel lblMyFriend2 = new JLabel("Suri-kun");
    lblMyFriend2.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblMyFriend2.setBounds(25, 217, 242, 24);
    contentPane.add(lblMyFriend2);

    JLabel lblApplicationVersion = new JLabel("Version: " + AppVersion);
    lblApplicationVersion.setFont(new Font("Dialog", Font.BOLD, 14));
    lblApplicationVersion.setBounds(382, 16, 132, 18);
    contentPane.add(lblApplicationVersion);

    JLabel lblForMyOther = new JLabel("For my other Android stuff visit me on XDA - Developers (@kvsjxd)");
    lblForMyOther.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            try {
                Desktop.getDesktop().browse(new URL(
                        "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594")
                                .toURI());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
            lblForMyOther.setForeground(Color.BLUE);
        }

        @Override
        public void mouseExited(MouseEvent e) {
            lblForMyOther.setForeground(Color.BLACK);
        }
    });
    lblForMyOther.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblForMyOther.setBounds(25, 321, 502, 24);
    contentPane.add(lblForMyOther);

    JLabel lblMySensei2 = new JLabel("Karun Sensei");
    lblMySensei2.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblMySensei2.setBounds(25, 120, 242, 24);
    contentPane.add(lblMySensei2);

    JLabel lblMySensei1 = new JLabel("Prashotam Sensei");
    lblMySensei1.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblMySensei1.setBounds(25, 98, 242, 24);
    contentPane.add(lblMySensei1);

    JLabel lblDaretobe = new JLabel("D4r3T0B3");
    lblDaretobe.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblDaretobe.setBounds(25, 194, 242, 24);
    contentPane.add(lblDaretobe);

    JLabel label_9 = new JLabel("");
    label_9.setToolTipText("This variation of android robot is created using Androidify");
    label_9.setIcon(new ImageIcon(About.class.getResource("/graphics/Droidrobot.png")));
    label_9.setBounds(334, 50, 180, 270);
    contentPane.add(label_9);

    JLabel lblDeveloper = new JLabel("Developer");
    lblDeveloper.setFont(new Font("Dialog", Font.BOLD, 16));
    lblDeveloper.setBounds(25, 12, 233, 24);
    contentPane.add(lblDeveloper);

    JLabel lblMrAleksandarDespotovski_shi = new JLabel("Aleksandar Despotovski-shi");
    lblMrAleksandarDespotovski_shi.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblMrAleksandarDespotovski_shi.setBounds(25, 169, 242, 24);
    contentPane.add(lblMrAleksandarDespotovski_shi);

    JLabel lblMyname = new JLabel("Karanvir Singh");
    lblMyname.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                Desktop.getDesktop().browse(new URL(
                        "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594")
                                .toURI());
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
            lblMyname.setForeground(Color.BLUE);
        }

        @Override
        public void mouseExited(MouseEvent e) {
            lblMyname.setForeground(Color.RED);
        }
    });
    lblMyname.setForeground(Color.RED);
    lblMyname.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 16));
    lblMyname.setBounds(25, 36, 242, 24);
    contentPane.add(lblMyname);

    JLabel lblMyFriend1 = new JLabel("My friend - Chetan-kun");
    lblMyFriend1.setFont(new Font("Dialog", Font.PLAIN, 15));
    lblMyFriend1.setBounds(25, 145, 242, 24);
    contentPane.add(lblMyFriend1);

    JLabel label_6 = new JLabel("Special thanks to");
    label_6.setForeground(UIManager.getColor("OptionPane.questionDialog.titlePane.shadow"));
    label_6.setFont(new Font("Dialog", Font.BOLD, 16));
    label_6.setBounds(25, 71, 240, 25);
    contentPane.add(label_6);

    JLabel lblGoogle = new JLabel(
            "Android, android green colored robot are trademarks of Google, Inc. We are not affliated with Google, Inc. in any way.");
    lblGoogle.setHorizontalAlignment(SwingConstants.LEFT);
    lblGoogle.setFont(new Font("Dialog", Font.PLAIN, 8));
    lblGoogle.setBounds(25, 341, 514, 24);
    contentPane.add(lblGoogle);
}

From source file:com.game.ui.views.MapEditor.java

@Override
public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand().equalsIgnoreCase("Save Map")) {
        UserDialog dialog = new UserDialog("Pls Enter the Map Name.", this);
        String mapName = dialog.getValue();
        if (StringUtils.isNotBlank(mapName)) {
            GameBean.mapInfo.setMapName(mapName);
            File file = new File(Configuration.PATH_FOR_MAP);
            MapInformationWrapper wrapper = null;
            if (file.exists()) {
                try {
                    wrapper = GameUtils.readMapInformation(Configuration.PATH_FOR_MAP);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }//from  ww  w .  ja  v a2  s  .c  o  m
            } else {
                wrapper = new MapInformationWrapper();
            }
            if (wrapper != null) {
                try {
                    wrapper.getMapList().add(GameBean.mapInfo);
                    GameUtils.writeMapInformation(wrapper, Configuration.PATH_FOR_MAP);
                    JOptionPane.showMessageDialog(this, "Saved Successfully..");
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    } else {
        JButton src = (JButton) ae.getSource();
        String location = src.getActionCommand();
        GameBean.mapInfo.getPathMap().put(Integer.parseInt(location), null);
        GameBean.mapInfo.getStartPointInfo().remove(new Integer(location));
        new ComplexDialog(location);
        TileInformation info = GameBean.mapInfo.getPathMap().get(Integer.parseInt(location));
        if (info != null) {
            if (info.isStartTile()) {
                src.setBackground(Configuration.startPointColor);
            } else if (info.isEndTile()) {
                src.setBackground(Configuration.endPointColor);
            } else if (info.getEnemy() != null) {
                src.setBackground(Configuration.enemyColor);
            } else {
                src.setBackground(Configuration.pathColor);
            }
        } else {
            Color color = UIManager.getColor("Button.background");
            src.setBackground(color);
        }
    }
}

From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java

private JPanel createServerPanel(final Server server, final JList list, final int index,
        final boolean isSelected) {
    final JXPanel p = new JXPanel();
    p.setLayout(new GridBagLayout());
    final Color background = Colors.alpha(getBackgroundColor(list, index, isSelected), 0.4f);

    p.setBackground(background);/*w w  w.  j  ava2  s  .  c  o m*/

    Color color1 = Colors.White.color(0.5f);
    Color color2 = Colors.Gray.color(0.95f);

    final Point2D start = new Point2D.Float(0, 0);
    Point2D stop = new Point2D.Float(150, 500);

    if (server != null && !server.sshWillFail() && server.getServerStatistics() != null) {
        final ServerStatisticsManager manager = server.getServerStatistics();
        final Datastream.WarnLevel warnlevel = manager.getHighestWarnLevel();

        if (warnlevel == Datastream.WarnLevel.HIGH) {
            color1 = Colors.Red.alpha(0.2f);
            color2 = Colors.Red.alpha(0.8f);
            stop = new Point2D.Float(500, 2);
        } else if (warnlevel == Datastream.WarnLevel.MEDIUM) {
            color1 = Colors.Orange.alpha(0.3f);
            color2 = Colors.Orange.alpha(0.8f);
            stop = new Point2D.Float(500, 2);
        } else if (warnlevel == Datastream.WarnLevel.LOW) {
            color1 = Colors.Orange.alpha(0.2f);
            color2 = Colors.Orange.alpha(0.4f);
            stop = new Point2D.Float(500, 2);
        }
    }

    final LinearGradientPaint gradientPaint = new LinearGradientPaint(start, stop, new float[] { 0.0f, 1.0f },
            new Color[] { color1, color2 });
    final MattePainter mattePainter = new MattePainter(gradientPaint, true);
    p.setBackgroundPainter(mattePainter);

    if (isSelected) {
        p.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(UIManager.getColor("List.background"), 2),
                BorderFactory.createBevelBorder(BevelBorder.LOWERED)));
    } else {
        p.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(UIManager.getColor("List.background"), 2),
                BorderFactory.createEtchedBorder()));

    }

    return p;
}

From source file:net.sf.jhylafax.JHylaFAX.java

public static void initializeToolkit() {
    // configure UI properties
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    UIManager.put("SplitPaneDivider.border", new BasicBorders.MarginBorder());
    UIManager.put("TitledBorder.font", UIManager.getFont("Label.font").deriveFont(Font.BOLD));
    UIManager.put("TitledBorder.titleColor", UIManager.getColor("Label.foreground").brighter());

    Builder.setProperty(DefaultFactory.ENHANCED_TEXT_FIELD_MENU_KEY, true);
}

From source file:edu.ku.brc.specify.tasks.ExpressSearchTask.java

/**
 * //from  www . j a va 2  s .c  om
 */
public void appContextHasChanged() {
    if (searchText != null) {
        if (searchText instanceof JAutoCompTextField) {
            ((JAutoCompTextField) searchText)
                    .setPickListAdapter(PickListDBAdapterFactory.getInstance().create("ExpressSearch", true));
        }

        AppPreferences localPrefs = AppPreferences.getLocalPrefs();
        searchText.setText(localPrefs.get(getLastSearchKey(), ""));
    }

    if (searchBtn != null) {
        searchBtn.setEnabled(true);
        searchText.setEnabled(true);
    }

    if (textBGColor != null) {
        searchText.setBackground(textBGColor);
        searchText.setForeground(UIManager.getColor("TextField.foreground"));
    }

    SearchConfigService.getInstance().reset();

    if (searchBox != null && searchBox.getMenuCreator() != null) {
        searchBox.getMenuCreator().reset();
    }
}