JavaFX 2.0 :: Manipulating Several Windows (Window Inside Window)
Apr 6, 2015
I am new to javafx I start using it instead of swing i used the scene builder for my forms the problem i faced i don't know how to have main screen with menu bar at top and depending the select from the menu it will open other windows and those window must be inside my window just like for example netbeans.
I don't need to open new window in separate i need all windows inside my main window and controlling over them minimize maximize perhaps.
View Replies
ADVERTISEMENT
Feb 18, 2014
I'm trying to right a GUI in swing, and as part of my program, I want to open a secondary window out of the main window when a mouse clicks on the main window. Then, once I click a button on the secondary window, I want that window to close and submit data to the main window (like an info form). I have almost figured out how to do this, except for one problem. By putting a variable inside my form window called "ready," and then in my main window running a loop that constantly checks if ready is true and doesn't proceed until its true, I can create the form window, modify the values in it (currently just one value called "difficulty" that's modified by a jSlider), and then when i click the "begin" button, ready is changed to true, the form window closes, and the main window can proceed. However, when I try to put the while loop checking the ready variable inside a mouseClicked method in the main window, the form window freezes when it opens, and you can't see any of its content or modify it in any way (you can't even close it).
Here is my code:
//form window class
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class formWindow extends JFrame {
private JTextField instructions1;
[Code]...
View Replies
View Related
Apr 8, 2014
I am trying code that When i press a button(New user), i want the event to send me to a new windows that i have created in Scenebuilder... I dont know why it wont work, i get this exception:
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown Source)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
[Code] .....
My controller.
package controllers;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
[Code] ....
The main windows does work, but just when i press the button i get that nasty exception...
View Replies
View Related
Sep 30, 2014
I would like to keep the same values of the positions for dividers (SplitPane) even if the width or the height of the window changes. I want to keep the proportion of the differents dividers. After resizing the window, the values of positions are not the sames ! I use this source without success :
stage.widthProperty().addListener(new ChangeListener<Number>() {
@Override public void changed( ObservableValue<? extends Number> observableValue, Number number, Number number2) {
sp.setDividerPositions(0.40f, 0.02f, 0.54f);
[Code] ....
View Replies
View Related
Jan 24, 2015
I've been having great success developing a drag-drop component for a JavaFX app, but I've run into an issue that has me completely stumped.
Specifically, I create a component that can be dragged around inside an anchor pane. That anchorpane is nested in a split pane, which is nested in another anchor pane (the control's root element).
The issue can be described this way:
Case #1: If I start the application as a small window, I can reposition the control by dragging it around the screen as I please.
Case #2: If I start the application and maximize the window, again, I can drag the control around the screen as I please.
Case #3: If I start the application, drag the control around a bit, then resize the window, the drag event handling breaks as follows:
1. The control drag events will fire normally only within the bounds of the anchor pane's previous size.
2. The mouse cursor's drag icon changes as I pass in or out of those bounds
I'm absolutely certain the anchorpane is resizing to match the parent window, otherwise Case #2 would not succeed. I'm at a complete loss as to determine why the drag events don't fire within the bounds of the resized window after they've been fired within the bounds of it's previous size.
Understand the mechanism I'm using to establish the drag handling: Once the controller is instantiated and added to the scene, an event listener on the class's parentProperty fires to attach the drag event handling to the parent node.
Previously, I was setting / clearing the drag handling on the parent node in the drag detection / drag dropped event handlers. I had suspected that adding / removing drag events was causing the trouble and opted for this solution to ensure that the same event instance was being used each time. Both methods have had the same result.
If you want to see the UI in action, here's a youtube link (it does not demonstrate the problem I'm having):
[URL]
Here's the code that I'm using, redacted for clarity:
public class FileSystemNode extends AnchorPane {
@FXML private AnchorPane fs_node_title;
private FileSystemType mFsType;
private Point2D mDragPoint;
[Code]....
View Replies
View Related
Feb 5, 2014
Is it possible to display an AWT Window only(just 'cause feel like doing it)? Or, is the simplest window possible to display a JFrame?
View Replies
View Related
May 8, 2014
I am writing a small app to automate some actions on my computer this requires me to open an application and click on a button I am using
Process child0 = Runtime.getRuntime().exec("/home/user/application");
to do this. The problem is every time it opens at a different lcation on the screen so i cannot click on it using the robot class due to x,y coordinates being different every time. with selenium you can use .setlocation(x,y) method but how can this be done for other applications.
View Replies
View Related
Apr 19, 2015
I have an assignment to create a circle with a radius of 40px in a 100px by 100px window and move the circle with the arrow keys.The circle can't move past the the edges of the window. I believe I have the code right but the window won't create the window or pane with a width of 100 px because of the close, minimize, maximize buttons. Is there a way to remove those or force JavaFX to create it with a width of 100px? Here's what I've got so far.
package movecircle;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
[code]....
View Replies
View Related
Oct 9, 2014
How would i go about making this NOT resizable?
If I do try to do ChatFrame.setResizable(false); it gives me this error:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Cannot make a static reference to the non-static method setResizable(boolean) from the type Frame
at com.ui.ChatFrame.<init>(ChatFrame.java:37)
at com.ui.ChatFrame$5.run(ChatFrame.java:403)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
[Code] ....
Here is the code:
package com.ui;
import com.socket.History;
import com.socket.Message;
import com.socket.SocketClient;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
[Code] ....
View Replies
View Related
May 20, 2014
I have a WindowClosing(WindowEvent e) method, but when I close my window it isn't doing anything inside the method. I am making a launcher and I want to make it so when the actual game window is closed it makes the launcher window visible again.
Java Code: public void windowClosing(WindowEvent e) {
this.jf.setVisible(true);
} mh_sh_highlight_all('java');
View Replies
View Related
Jan 31, 2014
That's my third day working in Java using Swing and the IntelliJ Idea IDE.I'm trying to do something as simple as displaying a PNG in a window, and I'm doing this:
public class AboutRapide {
public JPanel mainPanel;
private void createUIComponents() {
mainPanel = new ImagePanel();
[cod]....
the problem is that, in the paintComponent method, the Image is never found when I run my app from the IDE, but it is when I run it from Finder in my Mac. Same application. I think it relates to how the application is launched so I guess what's a proper way to refer to a resource file with an image so it can be displayed no matter how the application is launched?Also if I generate a Jar for the application, as the resource gets into the Jar compressed file, it can't also be loaded.
View Replies
View Related
Mar 31, 2014
I am trying to repaint a window from another class. the class Window handles an interface that displays pictures of movies. Via a JMenuBar you can add a new movie and its picture but in order for it to show in the Window i need to repaint certain aspects in the Window class GUI;
The window class constructor:
public Window() {
addComponents();
configurFrame();
addMenu();
}
The functions i want to repaint:
public void repaintWindow() {
this.getContentPane().validate();
this.getContentPane().repaint();
}
From my other class where i add a movie to an ArrayList i have made a "private Window myWindow;" there i call the function repaintWindow via mywindow.repaintWindow(); But this gives me an NullPointerException related to the repaintWindow function.
View Replies
View Related
Jan 21, 2014
Whenever I make something in Swing, I always need to resize the window for me to see the graphics on the window. I have been told to use the pack() method on it, which I have, but the problem with it is that it just sets the window to a minimal size, only displaying the x + and -.For one of the "games" I made, it at first didn't work until resize, then I added a repaint() after the constructor and it worked for me, but when my friends download it they cannot see it.
View Replies
View Related
Apr 21, 2015
I have the following problem:I have 4 components in my GUI that goes like this in the CENTER of the BORDERLAYOUT:
1. JLabel
2. JTextArea
3. Jlabel
4. JTextArea
Everytime i make the GUI window bigger, all these elements spread out. How can i get these elements to have a BREAK line (i.e. a break line after 1. Jlabel) so that no matter how i stretch the window, it will stay in-tact and the other elements will follow underneath.
View Replies
View Related
Oct 2, 2014
My goal is to make 2 rectangles in the same window. so far I have this.
import javax.swing.JComponent;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
public class BoxComponent extends JComponent
[Code] ....
After running the program I get one rectangle, the red one. If I take the code out for the red rectangle, I only get 1 blue one. What am I missing?
View Replies
View Related
Jan 21, 2014
How one frame to another frame using button ?
View Replies
View Related
Jun 11, 2014
So I have basic java knowledge from 1st year of college and I wrote a program recently that sends keystrokes with the Robot class. Now I would like it to do the same but to send it to a window that isn't my active one.. I've searched and from what Ive found it seems like you cant do that in java, I need another language like C# (whick sux for me since i dont know any other then java).. Is this true? If not how would i send something to notepad for example while it is not the active window?
View Replies
View Related
Aug 20, 2014
I want to develop an application, which shows a circular window with close, maximize buttons.
I want to create something like this: [URL]
View Replies
View Related
Jun 4, 2014
I started a text based game, but I am dissatisfied with the console that PrintF prints to. How can I set up a window and have text output to that window, and have my player type responses in the window?
View Replies
View Related
May 17, 2014
I am relatively new to java, and i am trying to create a window inside of a 2d char array, and eventually i will have to draw other shapes in this window. so for example
* * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * *
The problem is my window is not drawing correctly too the border, but a couple extra chars on the x columns. Here is code. The dimensions of the window will eventually be passed through scanner in main, if i ever work out how to even draw it.Also, in class we never learnt to use the Graphics class, so im pretty sure we are not supposed to use it.
public class Window
{ //default values
private int xRow;
private int yCol;
private char ch;
public char[][] windowz = new char[30][20]; //30,20 (yx)flat values cuz doesnt work
[code]....
View Replies
View Related
Jun 17, 2014
I would like to learn how to add an image background to a window in java that I can put controls like buttons, textboxes, and checkboxes in front of. I already tried using a JLabel with an ImageIcon but I cannot overlay controls over the JLabel. From what I understand there are multiple ways to do this. What is the best way and how can I do it?
View Replies
View Related
Dec 20, 2014
I am trying to create a gambling POS system and having problems with a method trying to get a value right after it was set. A jbutton sets another jframe visible which contains buttons. Upon action of the button, a value is set and the jframe is disposed.
private void btnPrizeActionPerformed(java.awt.event.ActionEvent evt) {
PrizeSelling prize = new PrizeSelling();
prize.setVisible(true);//create prize selection window
bin = getButton(); //gets what button is selected to load the correct prizes for correct game
prize.DBconnect(bin);//sends bin number to prize loading method
[Code] ....
As soon as btnPrize is clicked it gets the total value of the prizes selected which of course is 0 because it is ran before it is set. How can I make it wait until the window is closed before continuing?
View Replies
View Related
Jun 12, 2014
I am looking for a solution that will allow me to use a custom background image to replace the JFrame window. I am able to add a background Image, however I am not able to remove the "white" that is supposed to be transparent.
For example; if the image was shaped like a bird with transparent background (.PNG), I would like that to be put on the JFrame. Usually it will be a square with the image in the middle with white background, which I am unable to remove.
View Replies
View Related
Feb 4, 2015
I'm working on a spreadsheet like app using JTable and was wondering if I can make the first cell of the table be selected when the window opens. Is there a way to do so?
View Replies
View Related
Jun 24, 2014
I am writing a program that will have a GUI window and displays an image when clicked on the image changes and clicked on again the image changes once more. Here is what i have.
package ButtonLab;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
[Code]....
The issue i am having is when i run it the window pops up but with no images. The images wont load, I have tried to use the c: path to the image also.
View Replies
View Related
Jan 6, 2014
Here is the code:
the window opens, no errors, but the rectangle does not appear
Java Code:
import javax.swing.*;
import java.awt.Graphics;
public class myGame {
public int x = 20;
public int y = 20;
myGame(){
[Code] ....
I am using a text editor
View Replies
View Related