JavaFX 2.0 :: StackPane Doesn't Center Another AnchorPane
Dec 8, 2014
In the documentation of StackPane i read: "The stackpane will attempt to resize each child to fill its content area. If the child could not be sized to fill the stackpane (either because it was not resizable or its max size prevented it) then it will be aligned within the area using the alignment property, which defaults to Pos.CENTER."
But as I add another Pane (Anchor- or BorderPane) this added Pane is shows always in left upper corner of the StackPane. How could I force my StackPane to center another AnchorPane?
View Replies
ADVERTISEMENT
Jul 11, 2014
I built my application under Windows XP (x32), Eclipse Luna (x32), JDK 1.8 (x32 - beta version B116).
When i launch it, the splashscreen (preloader) appears !
I rebuilt my application under Windows 7 (x64), Eclipse Luna x64, JDK 1.8.0_20 (x64).
When i launch it, the splashscreen doesn't appear !!!
For information, The structure of my application :
app
| libs
| preloader.jar
myapplication.jar
runtime
The behavior of JDK 1.8.0_20 about the management of the preloading mecanism is it different of the behavior of JDK 1.8 (B116) ?
View Replies
View Related
Dec 9, 2014
I have a stylesheet (mystylesheet.css) with following entry:
.flowpane{
-fx-background-color: rgb(0,0,0);
}
In then start-method of my application I execute:
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.applyCss();
No FlowPane gets black. But if I do that in SceneBuilder and add the stylesheet to root than after loading Fxml-file the FlowPane gets black.
Another approach:
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.getStyleSheets().add(css.getFile());
root.applyCss();
Nothing happens.
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.getStyleSheets().add(css.getFile());
root.getStyleClass().add("flowpanel");
root.applyCss();
Doesn't work too;
but root.setStyle("-fx-background-color: rgb(0,0,0) works. But I need to style my application by css-files.
View Replies
View Related
Oct 15, 2014
I have noticed a strange behavior of Combobox element. The number of visible rows is not the same established by setVisibleRowCount() method. It happens when changing the items list dynamically. The following example reproduces it. I think it is Javafx 8 bug. I have tried unsuccessfully to trigger some event indirectly to refresh the combobox drop down.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TestComboBox extends Application {
private int count;
[Code] .....
View Replies
View Related
Aug 28, 2014
Since the upgrade to JavaFX 8u20 my ProgressIndicator won't rotate anymore when using Caspian style. Is there any workaround for this?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ProgressIndicator;
import javafx.stage.Stage;
public class TestApp2 extends Application {
public static void main(String[] args) {
[Code] ....
View Replies
View Related
Oct 3, 2014
I am using:
Java:..... 1.8.0_20JavaFX:... 8.0.20-b26
I have this class:
public class Person {
private SimpleStringProperty name;
public SimpleStringProperty nameProperty(){
if(this.name==null){
this.name=new SimpleStringProperty();
[Code] .....
I have this:
lista = FXCollections.<Person>observableArrayList();
lista.addAll(new Person("uno"),new Person("due"),new Person("tre"));
myListView.setItems(lista);
The problem is if I add /remove an item all is fine, the listView refreshes correctly:
Person p = new Person(tfld_textAdd.getText());
lista.add(0, p);
But if I change a value on an item into the observable list it doesn't:
lista.get(0).setName("new value");
I also have a table linked in the same way and the table workd correctly after I updated my Java version...
View Replies
View Related
Sep 9, 2014
I'm using Scene Builder 2.0 and have added an ImageView to the parent AnchorPane. I've added my PNG files for the app icon and the various buttons. I select the ImageView in Scene Builder and then crawl the filesystem to the project package folder and select the PNG for the Image. The assigned image is displayed in the Imageview in Scene Builder in both design mode and Preview mode.
While everything else shows up properly when the app is executed, the image assigned to the ImageView does not display.
From the FXML file:
<ImageView fx:id="ivBRULogo" fitHeight="64.0" fitWidth="64.0" layoutX="14.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0">
<image>
<Image url="@BRU_PE_B_64.png" />
</image>
</ImageView>
What might be occurring between the compiled app and what Scene Builder generates?
View Replies
View Related
Apr 7, 2014
I am trying to create a game in java for my final project for schhol but am having problems with my jframe. I want my 3 Jbuttons to be in the center of the jframe and be vertical but can not seem to get the 3 buttons in the center of the jframe ....
import javax.swing.*;
import java.awt.Container;
import java.awt.*;
public class SnakeObject extends JFrame
{
public SnakeObject()
{
createframe();
[Code] ....
View Replies
View Related
Feb 10, 2014
I'm using the Spring Layout Manager to put a form in a JPanel and I'm trying to center the lines horizontally so they will stay centered when the window is resized. Nothing I've tried has worked, I can't find anything on the web, and even my fallback of seeing how Netbeans does it fails as Netbeans doesn't seem to support the Spring Layout.
View Replies
View Related
Jun 17, 2014
So here's my code as it is right now:
Java Code:
public class PrintHoledRectangle
{
public static void main(String[] args)
{
int width = Integer.parseInt(args[0]) / 2 * 2 + 1;
int height = Integer.parseInt(args[1]) / 2 * 2 + 1;
int centre = width * height / 2 + 1;
int index = 0;
[Code] ....
The width of the rectangle to be printed is given by the first argument, the height by the second
The centre tile ("[_]") of the rectangle (to be printed as " ") is given by the formula: ((width*height)/2)+1, assuming you count each tile left-to-right, top-to-bottom
My thinking is that the programme keeps a running count (seen as 'index') so that, when the centre tile is to be printed, it outputs " ", otherwise "[_]", hence the if-else statement
Currently, it prints "[_]" to infinity
View Replies
View Related
May 5, 2014
Normally, the height of the CENTER component (or position) is greater than that of the NORTH and SOUTH components in a BorderLayout.
Is it possible to increase the size of the SOUTH component and decrease the size of the CENTER position because the jcomponents I want to add in the SOUTH component are bigger? or shall I have to change the layout and use some other layout?
View Replies
View Related
Sep 18, 2014
You have been given the job of writing a program to assist pilots who fly the Beechcraft Starship-‐‑1 executive aircraft.As with any airplane, it is essential that the pilot know the total weight of the loaded plane at takeoff and its center of gravity. If the plane weighs too much, it won'ʹt be able to lift off. If the center of gravity is outside the limits established for the plane, it might be impossible to control. Your task is to write a program that will determine the total weight and center of gravity of this plane
Inputs: The number of crew members, number of passengers, weight of the forward baggage compartment contents, aft baggage compartment contents weight, and the amount of fuel in gallons are to be accepted as INTEGER values in the order stated. Be sure the input values are within acceptable ranges
Outputs:You must echo the input values, annotated with their appropriate names,calculate and display the total weight, and the center of gravity.
View Replies
View Related
May 6, 2014
The goal is to desplays circles (max of 30) of fixed radius = 20, with the rightmost circle drawn in blue and left most circle in red and the rest are in white. The center is determined by the location of the point where the mouse is pressed. the number of circles is equivalent to number of mouse has been pressed_ the circles will be drawn only when you push the "draw" button.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.JPanel;
public class CirclePanel extends JPanel {
private final int WIDTH = 500, HEIGHT = 300;
private final int RDIUS = 20;
private final int MAX = 30;
[code]...
View Replies
View Related
May 1, 2015
Write a program that draws 20 circles, with the radius and location of each circle determined at random...... Two circles overlap if the distance between their center points is less than the sum of their radii...
There may be many problems with the code in general but what I'm struggling with is the distance and the totalradius portion. Visually, its inaccurate.
import java.awt.*;
import javax.swing.*;
public class CircleTest extends JPanel {
Circle []circles;
Circle []circleCenter;
Circle []all;
private int distance, totalradius, dx, dy;
private int radius,x,y;
[Code] ....
View Replies
View Related
Dec 13, 2014
so i followed a tutorial on youtube called "Java Game Development with Slick" - by thenewboston,URL....okay, so i have made my game / program, and now i just want to export it to a jar file that people can double click and play..unfortunately when i double click the .jar file nothing happens...i get the little "loading" thingy on my courser but it disappears after about 5 seconds and then nothing happens :(the way i made it into a jar file is by doing the following:
-right clicked my java project..
-clicked on "export"..
-clicked on java / Runnable JAR file
-filled in the stuff, (JARs destination ect..)
-pressed finish..
-then i got a jar file on my desktop and double clicked it....but as i said....nothing happens
View Replies
View Related
Apr 8, 2014
Since I done a recent git pull on my project, for some reason now Im getting an error when starting Tomcat and rendering the index.jsp, but I dont understand whats changed, as this was working before.
The error:
org.apache.jasper.JasperException: /index.jsp (line: 4, column: 42) File "/blog.postTags" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:168)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
The index.jsp:
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="p" uri="blog.postTags" %>
<html>
<head><title>Blog Home</title></head>
<body>
<h1>Blog Home</h1>
<br />
<% out.println("Your IP address is " + request.getRemoteAddr()); %>
[code]....
I really am unsure as to why this has stopped working, I even rolled back to an earlier commit and this was definitely working before, but I havent changed anything, Initially when you start Tomcat is shows another error in the browser, but on a refresh its a null on this tag library?
View Replies
View Related
Apr 28, 2014
Write a program that asks the user for the low and high integer in a range of integers. The program then asks the user for integers to be added up. The program computes two sums:
The sum of integers that are in the range (inclusive), and the sum of integers that are outside of the range. The user signals the end of input with a 0.
Your output should look like this:
Sample input/output
In-range Adder Low end of range: 20
High end of range: 50
Enter data: 21
Enter data: 60
Enter data: 49
Enter data: 30
Enter data: 91
Enter data: 0
Sum of in range values: 100
Sum of out of range values: 151
This is my assignment and below is my code.
import java.util.Scanner;
class InRangeAdder {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
int low, high, data=1, rangesum=0, outrangesum=0;
[Code] ....
The problem is that the program simply gives an output of 0 for both "rangesum" and "outrangesum". I don't quite understand why that is. Also i have a quick question, the program needs me to end the program when the value of data is 0 but in order to initialize it I need to give it a value. Usually I would give it a value of 0 like I have for rangesum and outrangesum but if I do the program does not run till the loop as it considers the value of data to be 0 and ends the program right away. What would be a work around to this and when do I need to have a value to initialize an integer? for example, I do not need a value for low and high. Is this because the program recognizes that a value is going to be defined but cannot do that for the other integers as they are inside a loop?
View Replies
View Related
Nov 20, 2014
if(false){}
but this is not
for(;false;){}
both will in theory never go in more interestingly this will compile
for(;false == false;){}
To me it seems like this is a parsing issue that could have been solved by the people who originally wrote the parser but they made a decision that there must be a relational operator in the condition declaration.
View Replies
View Related
Jul 3, 2014
I have the following code:
<% String callImp = null;
callImp = request.getParameter("callImp");
System.out.println("Call Importer: " + callImp)
if (callImp == null){
System.out.println("Aici null");
%>
and i have an [url] ....
Why is getParameter always returning null?
View Replies
View Related
Mar 28, 2015
why this code, doesn't display the image?
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
[code]...
View Replies
View Related
Dec 18, 2014
I'm trying to open an image within a JFrame but the image doesn't show. The directory path is correct. The JFrame opens perfectly but no image is showing.
JFrame frame = new JFrame("IMAGE");
frame.setSize(500,500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ImageIcon image = new ImageIcon("images/main.jpg");
JLabel label = new JLabel("", image, JLabel.CENTER);
JPanel panel = new JPanel(new BorderLayout());
panel.add( label, BorderLayout.CENTER );
frame.setVisible(true);
View Replies
View Related
Mar 29, 2014
In fact, I'm not yet past that "Hello World" program.I'm following the steps in "Head First: Java" book, and reached that point where one is ready to write his/her 1st Java code. Here's mine:
public class MyFirstApp
{
public static void main (String[] args)
{
System.out.println("I Rule!");
System.out.println("The World!");
}
}
As simple as it should be, and compiles fine producing the correspondent class. But it doesn't run, however, and spits the following execution-time errors:
Exception in thread "main" java.lang.UnsupportedClassVersionError: MyFirstApp : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
[code]...
View Replies
View Related
Jul 17, 2014
I am trying to present the user with a response of 'correct' or 'incorrect'. I do the following, but mResultTextView never updates.
mResultTextView.setText("Correct");
android.os.SystemClock.sleep(1000);
I think the problem is that my view needs to be re-drawn.
package com.example.quiz;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import android.graphics.Color;
[code]...
View Replies
View Related
Feb 18, 2014
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class frmSearch extends JDialog
{
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
JPanel jpnlMain = new JPanel();
[Code] ....
View Replies
View Related
May 18, 2015
Is there a short term that means: "using an object reference with the datatype of a supertype to refer to an object with the datatype of a subtype"?
Saying "polymorphic reference" doesn't seem to be specific enough because ALL references other than those with the Object datatype are polymorphic. I saw one post that referred to these reference variables as a "supertype reference." In the absence of any other (more official) term, I may just use that term because calling a reference a "supertype reference" implies that there is a subtype. It sure beats what I was thinking about using: "sub-as-super." Which, when the inevitable mispronunciations occur, would lead to all kinds of off-color jokes.
Is there an "official" term that all of the dozens of Java books I have read seem to have missed? Or does everyone stumble along, spelling things out with a nearly sentence-long phrase.
View Replies
View Related
May 2, 2014
Barbara is opening a book store, and she needs an effective, efficient, object-oriented program to keep track of her inventory. Barbara would like to maintain the following information about the books she sells: title, author, price, number in stock, and category. She categorizes her books into fiction, nonfiction and children’s books, because she has a separate room in her store for each category. Each book also needs an inventory number, and Barbara would like these numbers to start with 1000. She also needs to be able to keep track of the total number of books in inventory.
Barbara often facilitate her customers find books, and the program needs search capabilities to do this. Keeping an accurate inventory count of each book in stock is critical; both for accounting purposes and so she will know when to reorder. Barbara expects to have at most 2,000 differet books in her store.Barbara is very organized, and would like a nice menu, from which she can make choices that will enable her to do the following:
Add a new book to inventory
This adds a new Book object (title, author, etc) into inventory
It does not increase the number in stock of an existing book
Search by title
Search by author
Search by inventory number
Search by category
Print out all info for all books
This is the only output that should be on the command line
Please hard code the following book info into your program, so Barbara has some test data avaiable to test your program:
title: Crime and Punishment; author: Dostoevsky; price: 39.95; number in stock: 5; category: fiction
title: Brothers Karamazov; author: Dostoevsky; price 34.50; number in stock: 3; category: fiction
title: Java; author: Liang; price: 59.29; number in stock: 12; category: non-fiction
title: Java, author: Horstmann; price: 14.33; number in stock: 4; category: non-fiction
title: The Lion, the Witch and the Wardrobe; author: Lewis; price: 12.50; number in stock: 3; category: childrens
Here is my code so far. The first one is the "Blueprint" and the second one is the main.
public class Book
{
private String title;
private String author;
private double price;
private int stockNumber;
private String category;
private int inventoryNumber =1000;
private static int numberOfBooks = 0;
public Book(String theTitle, String theAuthor, double thePrice, int theStockNumber, String theCategory)
[code]....
View Replies
View Related