JavaFX 2.0 :: Chart Axis Changing Color
Mar 20, 2015I'm struggling to change the colour of the X and Y axis. I can change the colour of the ticks and the tick labels in CSS... But not the axis themselves.
View RepliesI'm struggling to change the colour of the X and Y axis. I can change the colour of the ticks and the tick labels in CSS... But not the axis themselves.
View RepliesNo problem setting background color for layouts, e.g. bdrPn.setBackground(new Background((new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY))));
But neither of the following are working for me, running JavaFX 8 on latest OS-X
scene = new Scene(bdrPn, winW, winH, Color.BLACK);
scene.setFill(Color.BLACK);
scene.setFill() worked fine for previous versions of JavaFX.
I have a UI widget, like a table view for example, displaying real-time data. This table can be configured - so it has many properties. The way I would like to do so, is to have a small 'configure button', once clicked, would rotate the entire table along its y axis, and display another panel with checkboxes etc... So effectively, the hidden properties panel is revealed by rotation.
View Replies View RelatedColor only changes, when resizng frame with mouse, not when clicking.
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class SimpleGui1 implements ActionListener {
JFrame frame;
MyDrawnPanel drawnPanel;
[Code] .....
The Toys of the Future Company has decided to issue a new line of toy robots. While they are not sure exactly what their robots will look like, they do know the functionality that they will all have. All robots will be able to move forward, turn right, turn left, spin and detect an object in front of it via a sensor. The robot will use a touch sensor to determine whether it has hit an object in front of it, such as a wall. The robot will have two, three, or four wheels, but it will only be driven by two of them: a right wheel and a left wheel. Each wheel will be attached to a motor that controls it.
* ^ this is only something to think about
Produce a UML class diagram.
Using UML, describe the objects and classes that will be associated with this new toy. Either hand draw or use an appropriate UML creation tool to generate a UML design document for your Robot class. Create a set of classes that can be used to control the robot.
Develop your new class.
Create a new NetBeans project entitled, "Assignment_8_1" and develop your new class. Now, using the objects and classes that you have written, write a program for your robot that allows it to move in a large square. Allow your robot to run in a big two dimensional array and every time the robot encounters a square in your array, turn that square black.
So here is the code for the moving ball:
package ballapplet;
import java.awt.*;
import java.util.Formatter;
import javax.swing.*;
public class BallApplet extends JPanel {
private static final int BOX_WIDTH = 640;
[Code] ....
I want to know how to change the color of an object, and how to move it in specific directions.
Currently I try to integrate a JavaFX BarChart into my existing Java application. Therefore I need a BufferedImage of my BarChart, so that I can render that snapshot on a Graphics instance.
I adapted the existing BarChartSample.java (Chart Sample | JavaFX Tutorials and Documentation) and removed all animations. The code itselfs works fine but I identified one problem -> my TickLabels are missing
The TickLabels are visible If I use JDK 1.7u51 but if I change to JDK 1.8u05.... than the stlye of my BarChart will be changed and my tick labels are not visible.
Did I missed something or is that a bug?
using JDK 1.7u51
[URL] .....
using JDK 1.8u05
[URL] .....
My adapted code is the following:
package barchartsample;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
[Code] .....
I would like to draw a rectangle around a certain part of an image.
So I wrote this:
Pixel[] pixels = scene.getPixels();
for( Pixel pixel : pixels)
{
if(pixel >= point.getX() && pixel <= (point.getX()+p2.getWidth())
{
pixel.setGreen(150);
}
}
But the error is giving me incompatible types. I would like to set all the pixels at a certain point up to the dimensions of my rectangle and so on. How would I do that?
In the image, the color of the frame of the window/JFrame is black. My question is that can we set the color of this frame, or is it just provided by the operating system and whatever color is default color of windows in an operating system will appear in our application?
I am talking about the frame, the boundary in the JFrame container which contains the close, maximize, and minimize buttons.
I'm trying to build a program which sets a fill color for a rectangle. Each time the mouse is clicked the fill color changes according to the position of the mouse's X and Y. I succeeded to create a JFrame with a changing background according to the Mouse's position, but I can't seem to change the color of the rectangle (defined in MyPanel class).
This is the current code,
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
[Code]...
is there a good way to change the color of a JList item that isn't selected? I'm throwing my hand at building a client/server chat app and on the client side, I need to highlight the name of the person (which is in a JList) who has sent a message to the client GUI.
View Replies View RelatedI am trying to create a virus simulation program. The program is supposed to just be a map of the world where the user can click any country in the world to specify where they want their virus to start, specify how transmittable the virus is, and be able to see how the virus spreads through the world by seeing a change in color throughout the world,
I want the world map to initially start out with a very light yellow, and as areas of the world slowly start to get more and more infected by the virus, I want those areas on the map to start changing to a very dark red (going from a light yellow, through shades of orange and red, to dark red).
So, the main idea of this is to have a program that displays an image where certain parts of the image will slowly change color during the runtime of the program. I obviously know how to change colors of certain parts of a window or even an image, and how to even start this.
I want to print a table (array) where I have an X axis and a Y axis. 16x11. My code is as follows:
int Windchill [] [] = new int [16][11];
{
{60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5, 0, -5, -10, -15} //X
{0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50} //Y
};
The code doesn't work even though it's similar to
int Windchill [][] =
{
{60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5, 0, -5, -10, -15}, //X
{0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50}, //Y
};
if I remember correctly, the 2 are correct just written in different ways.
and I want it to print like this
{60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5, 0, -5, -10, -15},
{ 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
10, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
15, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
20, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
25, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
30, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
35, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
40, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
45, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,
50, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0, 0, 0,}
where 0 is null (for now). I want to fill those in with a formula later, but I don't hardcoding them one by one is the most "efficient" way to do it
how to change the color of an output element in Eclipse? Can't seem to find it anywhere on the internet.For example, a response to my question 'What color do you want?' could be 'red'. I added an if-statement, which states if input = red, start using a red colored 'X' as string for further output.How do I obtain the color red for my X?? Or isn't it possible changing the color of output elements?
View Replies View RelatedI am trying to create a virus simulation program. The program is supposed to just be a map of the world where the user can click any country in the world to specify where they want their virus to start, specify how transmittable the virus is, and be able to see how the virus spreads through the world by seeing a change in color throughout the world,
I want the world map to initially start out with a very light yellow, and as areas of the world slowly start to get more and more infected by the virus, I want those areas on the map to start changing to a very dark red (going from a light yellow, through shades of orange and red, to dark red).
So, the main idea of this is to have a program that displays an image where certain parts of the image will slowly change color during the runtime of the program. I obviously know how to change colors of certain parts of a window or even an image, but this is very very detailed and advanced but how to even start this.
My code is
Double qty = 0.0;
for ( int i = 0; i < ingTable.getRowCount(); i++){
qty = (Double) ingTable.getValueAt(i,2);
if( qty < 30.0){
ingTable.setBackground(Color.red);
} else {
ingTable.setBackground(Color.white);
}
}
I have this class and I want to pass "pergunta" from another class:
Java Code:
here* = if I put a number, the code works. I want to receive the parameter "pergunta" here but I can't put a parameter in start .
I want to populate the array pergunta in a previous class and use in this one.
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.chart.*;
import javafx.scene.Group;
[code]....
Using the sample, I tried to create a horizontal stacked bar chart, but it didn't render correctly. Only a sliver of one bar shows and cosmetically the bar's rounded corners are at the top instead of the right side.
@Override
public void start(Stage primaryStage) {
String austria = "Austria";
String brazil = "Brazil";
NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("Value");
xAxis.setTickLabelRotation(90);
[Code] ....
Oddly, if I change the second series to this, then only one bar shows:
series2.getData().add(new XYChart.Data(10, austria));
series2.getData().add(new XYChart.Data(15, brazil));
I want to create 4 quadrants on a bubble chart. How can I do that. I have already created by bubble chart. The quadrant chart using JFreeChart is given here (Dave Gilbert's Weblog : Weblog) but I want to create it using JavaFX charting.
View Replies View RelatedI have a Master/Detail application with a TreeView as Master Selection. I need to inhibit leaving a page if the contents are "invalid". How can I do that?
I tried to force the page again in a ChangeListener, but that doesn't work well, not even using Platform.runlater().
What's the "Best Practice" in this case?
I'm beginner with javaFX and i need to change language of the screen. but how to reload the screen when the language was changed. The application have a button where have the language available. I want just refresh screen when the user change language. Here is the start method to show the stage.
@Override
public void start(Stage stage) throws Exception
{
this.stage = stage;
Locale locale = Locale.getDefault();
ResourceBundle rb = ResourceBundle.getBundle("resources/Label",locale);
[Code] .....
Here is the function to change the language(in the same class with start function),the rb is the new ResourceBundle:
public void refresh(ResourceBundle rb)
{
//change the language here
}
1. I don't want to use the resourceBundle to get value in resource file and set label in scene one by one.like following:
this.btnLabel.setText(rb.getString(key.test));
...
2. I don't want to reload the scene,like following:
public void refresh(ResourceBundle rb)
{
try
{
loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml"),rb);
root = (Parent)loader.load();
[Code] .....
So do we have a solution to just set the resourceBundle and reload the scene easier?
I would like to change the color of the rows of my TableView. But the instruction setTextFill doesn't work. Is it normal ?
tableView.setRowFactory(new Callback<TableView<Person>, TableRow<Person>>() {
@Override
public TableRow<Person> call(TableView<Person> param) {
final TableRow<Person> row = new TableRow<Person>() {
@Override
protected void updateItem(Person person, boolean empty) {
super.updateItem(person, empty);
setTextFill(Color.RED);
}
};
return row;
}
});
I use SceneBuilder2.0 with JavaFX8 on OSX 10.9.4
When i use a stylesheet in SceneBuilder2.0 which uses a color-lookup the lookup fails with:
WARNING: Could not resolve 'abc' while resolving lookups for '-fx-background-color' from rule '*.button' in stylesheet supersimple.css
The color-definition is in the root-rule, so it should be found.
The lookup does work fine at Runtime.
There is a more complete description of the problem on stackoverflow:
javafx - SceneBuilder2.0 does apply rules with color-lookup - Stack Overflow
when i set a certain menuitem background color, the highlight is losed. What should i do?
View Replies View Relatedis possibile to change the color of the sorting arrow that appears in the columns of the Table View by css? My attempts have failed and I have not found any documentation, nor is there any reference in the Modena css.
View Replies View RelatedI've just started working on a program and i'm already having difficulties with the program. I can't get the background color to change from the basic gray color. Maybe you can tell me what i'm doing wrong.
import javax.swing.JFrame;
import javax.swing.WindowConstants;
import java.awt.*;
import java.lang.Object;
import java.awt.Color;
public class FrameDemo{
public static void main(String args[]){
Toolkit toolkit = Toolkit.getDefaultToolkit ();
[Code]...
also if theres any way to shorten up what I have there, that would be great.
If I want to read from file the word "red" And then the following is not the right way like in the code ,, How to set the Color name
File inputFile = new File ("C:\input.txt");
Scanner scan = new Scanner (inputFile);
String RedColor=scan.nextLine();
Color backColor = new Color(redColor);