Tag: colors

TYPE_INT_RGB和TYPE_INT_ARGB的格式

谁能解释一下java如何在TYPE_INT_RGB和TYPE_INT_ARGB中存储颜色? 这些代码行是否适用于计算红色,绿色和蓝色? int red= (RGB>>16)&255; int green= (RGB>>8)&255; int blue= (RGB)&255; 那么TYPE_INT_ARGB呢? 如何从TYPE_INT_ARGB获得红色,绿色和蓝色?

如何根据单元格中的值为JTable的单个单元着色?

我正在尝试制作俄罗斯方块克隆。 游戏使用JTable作为棋盘的代表。 该板是2D整数数组。 我试图这样做,当某个单元格具有一定的值时,单元格将变为某种颜色。 我以为我的工作正常,但它无法正常工作。 我真的很感激一些帮助。 谢谢。 这是我的代码: 板: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.Timer; import javax.swing.table.*; /** * @author _______________ * * Board.java * * The Board class gives information to the InitializeJTable class regarding * the data-type of the JTable elements, how many rows/columns are in the JTable, etc; * * […]

Nimbus L&F – 改变进度条的背景颜色

我正在使用Netbeans Editor开发一个带有Java的GUI应用程序。 我在JFrame中添加了一个简单的进度条。 我正在使用JDK7开发项目 我想将背景颜色从默认橙色更改为个人颜色。 我已经尝试了所有属性的颜色变化但是当我运行程序时颜色仍然相同。 我已经尝试过使用ProgressBar1.setBackground(new java.awt.Color(0,204,255)); 和 UIManager.put(“ProgressBar.background”, Color.YELLOW); UIManager.put(“ProgressBar.foreground”, Color.MAGENTA); UIManager.put(“ProgressBar.selectionBackground”, Color.red); UIManager.put(“ProgressBar.selectionForeground”, Color.green); 相同的结果…..背景总是橙色 这是我的测试项目的代码 public class Frame extends javax.swing.JFrame { public Frame() { initComponents(); } @SuppressWarnings(“unchecked”) // private void initComponents() { jProgressBar1 = new javax.swing.JProgressBar(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jProgressBar1.setBackground(new java.awt.Color(0, 204, 255)); jProgressBar1.setValue(75); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() […]

hover在JButton上时出现奇怪的颜色变化

好的,这是我在想要使用透明度时偶然发现的一个问题。 所以改变hover背景的代码就是这个…… received.setMouseListener(new MouseAdapter() @Override public void mouseEntered(MouseEvent me) { received.setBackground(new Color(50,50,50,100)); } }); 一开始我为按钮设置了蓝色.. 这是显示颜色变化的GIF …… GifMeme09541718022016.gif https://drive.google.com/file/d/0B9XFyaTVy8oYci1zMmRhMmtYcnM/view?usp=docslist_api 为什么会这样? 如果这不是正确的方法,那么正确的方法是什么?

获得最常见的图像颜色

我想从图像中获得最常见的颜色。 我使用Java,我希望拥有最主要的颜色。 有没有任何cbir java库来做这个? 谢谢

使用Nimbus更改JProgressBar的颜色?

有没有人知道如何在使用Nimbus LookAndFeel时更改JProgressBar的颜色?

java AbstractTableModel 2每行不同的颜色

我想提高我的jtable的可读性,下面是MyTableModel.java类,如何使每个行中有2种不同的颜色显示在这张图片中 。 应该具体的方法是,我可以为每一行提供不同的颜色,以提高用户的可读性。 public class MyTableModel extends AbstractTableModel{ String [] columnNames; Vector<Vector> data; public DataAccessObject ObjDb = new DataAccessObject (); public MyTableModel(String [] coln , Vector<Vector> data) { columnNames = coln; this.data =data; } @Override public int getColumnCount() { return columnNames.length; } @Override public int getRowCount() { return data.size(); } @Override public String getColumnName(int col) […]

Java JScrollBar设计

我想自定义JScrollBar设计。 我用Mac用eclipse开发应用程序。 我已经尝试过scrollPane.getVerticalScrollBar().setBackground(Color.BLACK); 但什么都没发生。 我的代码: scrollPane = new JScrollPane(scriptView); scrollPane.setBorder(BorderFactory.createEmptyBorder()); scrollPane.getVerticalScrollBar().setUnitIncrement(6); window.getContentPane().add(scrollPane); Object scriptView来自JEditorPane类。 应该如何看待: 谢谢你的帮助。

用另一种颜色显示System.out.println输出

我有一个很大的项目要调试,我想知道是否有我可以用来改变eclipse输出中的System.out.println方法 例如 : System.out.println(“I want this to be red”); System.out.println(“I want this to be blue”); System.out.println(“I want this to be yellow”); System.out.println(“I want this to be magenta”); 为了更好的可读性。 EDIT 与sysout我有这个 与syserr我有这个

用Java着色图像

我正在研究一些代码来用Java着色图像。 基本上我想要做的是GIMP的colorize命令,所以如果我有一个BufferedImage和Color,我可以用给定的颜色着色Image。 有人有任何想法吗? 我目前做这样的事情的最佳猜测是获取BufferedImage中每个像素的rgb值,并使用一些缩放因子将Color的RGB值添加到其中。