Tag: colors

Java Swing JButton时间延迟(闪烁)

我正试图让我的JButton闪烁红色为我正在创建的这个游戏。 本网站上的所有解决方案都建议使用一个线程并将其置于睡眠状态或使用计时器,但是,颜色变化之后似乎会出现暂停消息 这是我的代码: Color cb = board[Y1][X1].getBackground(); board[Y1][X1].setBackground(Color.RED); //Pause board[Y1][X1].setBackground(cb); 如果我放一个线程并让它在第3行睡觉并注释掉第4行,那么暂停将在JButton变为红色之前出现。 (注意板只是JButtons的2D数组)

JFreeChart BarChart – >没有渐变

默认情况下,我的条形图始终使用渐变颜色绘制。 我只想要一个没有任何风格效果的简单颜色。 有人可以帮忙吗? 码: final JFreeChart chart = ChartFactory.createBarChart( “”, // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend false, // tooltips? false // URLs? ); final CategoryPlot plot = chart.getCategoryPlot(); // SOMETHING HAS TO BE DONE HERE showChart(chart); // Simply […]

用于在甘特图中更改子任务颜色的代码

我需要在甘特图中更改子任务的颜色。 我的示例基于GanttDemo2具有以下数据集和渲染器。 在不同的论坛中,我发现了一些与此主题相关的讨论,但我没有找到一个清晰简单的工作示例。 特别是,我可以改变任务的颜色,但我不知道如何提取子任务。 private IntervalCategoryDataset createSampleDataset() { final TaskSeries s1 = new TaskSeries(“Scheduled”); final Task t1 = new Task( “Design”, date(1, Calendar.APRIL, 2001), date(1, Calendar.MAY, 2001)); t1.addSubtask(new Task(“Design 1”, date(1, Calendar.APRIL, 2001), date(15, Calendar.APRIL, 2001))); t1.addSubtask(new Task(“Design 2”, date(16, Calendar.APRIL, 2001), date(25, Calendar.APRIL, 2001))); t1.addSubtask(new Task(“Design 3”, date(26, Calendar.APRIL, 2001), date(1, Calendar.MAY, 2001))); s1.add(t1); […]