I'm fairly new to Java Swing/AWT et al and hence the question. I have a simple dialog with some text and a couple JButton. I am using the GridbagLayout for this dialog.
But when I look at the dialog, the JButtons are kind of having a weird shape and I cannot seem to right justify the text either.
Is this a limitation of the Layout I ...
could return boolean?
I want to new a JFrame if the JFrame not exsits,but not to new if exsits.
I creat a Map to save JFrame's name.
...
When I add more than one component on the JFrame , only the component which was added last is displayed , rest are not displayed , what is the issue with their visibility ?
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JLabel;
publ...
Hi, using an external library which creates a JFrame window, there is a way to preset its l&f before showing it?
also something like accessing its own thread could be a solution (via reflection I mean)?
Another question, time ago I watched some JFrame having custom aplha borders (some shape applied), could you tell me if it was a supp...
I have a Java program that I wrote that changes whether or not a JFrame is resizable depending on application state. In Windows this works great, when it is resizable the maximize button is enabled when it's not the button is disabled. However, on my Mac when I change resizable back to true the zoom button does not become enabled but the...
.
OVERVIEW, SAMPLE
Hello everyone,
I have created a basic Sudoku solver that can solve most problems fairly quickly. I still have a lot of work ahead of me to make it solve even the hardest problems, but I'd like to try to implement a basic JFrame GUI first.
I have worked with internet applets in the past, but never before with JFram...
Just need some quick guidance -
I have a main frame, and I want some smaller frames inside of it that can be dragged outside of the main frame (potentially onto multiple monitors). When dragged back in, they should not be hidden behind the main frame when the main frame is clicked on.
I'm unclear about what I should be using... JFrames...
hi, i'm traying a jdialog on linux, but it still appears in my taskbar.
this is the code? what's wrong?
import javax.swing.JDialog;
public class Main {
public static void main(String [] args) {
new mydialog();
}
private static class mydialog extends JDialog {
public mydialog() {
super();
...
The application I'm working on contains a main JFrame, from which users might eventually open another supplementary frame. I am trying to implement such a behavior of the app where the supplementary frame is minimized (iconified) as soon as the main frame gets minimized.
I was thinking of overriding the setExtendedState method of the ma...
Hey guys,
So I have a JFrame which I've added a custom JPanel component.
The JPanel component has a button that I want to attach a listener to in my JFrame.
What is the best way to do this?
...
Sample code:
JFrame jFrame = new JFrame("Test");
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jFrame.setLocationRelativeTo(null);
jFrame.setSize(600, 600);
jFrame.pack();
// jFrame.setLocationRelativeTo(null); // same results
jFrame.setVisible(true);
Is this the OpenJDK's fault? I recall hearing...
Why if I create a JFrame then the program still runs until (i.e) I close it with the small "exit button" of the window?
I looked for this answer and I failed. The only thing I guessed is that when I do "new JFrame()" it's like an special "new", that keeps a reference of the object in the EDT, so it will always be referenced (even if was...
Hi, im making a physics simulator for fun and i was looking up graphics tutorials when i tried to figure out the difference between all these J's. could somebody elaborate on them or perhaps provide a link to a helpful source?
...
Hey all,
Does anyone know how to maximize a JFrame once a specfic action has occured? I'll post my code below, I'm a fiend for not commenting my code (I'll do it at some point) but it should be fairly self explanitory. What I was trying to do was to get the frame to maximize once the option was selected from the menu. If anyone can tell...
I have an action listener set up on my main jframe menu for the buttons listed on it, and they work fine, bringing up other jframes as needed. The problem is when a person clicks the buttons on the jframes brought up I get a nullexception after a jbutton is clicked on that submenu jframe.
Example code:
public class main extends JFrame...
I am making a card game atm, and i want the card stack to be placed in the middle of a Jframe. Right now i have made the cardstack in a layeredPane. And that layeredPane is placed in a panel. And i want that panel to be placed in the midle of the frame, or the contentpanepanel....
Please help guys...
I dont want more sleepless nights...
Hi everyone,
Im trying to build a small frame that displays an image.
My problem is that in the paint(Graphics g) method, the g.drawImage is executed, but nothing is shown on my RLFrame.
Any thoughts / tips?
Thanks in advance.
Here's the code
public class RLFrame extends JFrame{
Image img;
public RLFrame(String title){
super(...
Hi, I have a JFrame that has a BottomPanel (a class I made that extends JPanel) inside it.
And inside that JPanel is another JPanel called DicePanel(that again extends JPanel).
In DicePanel there is a button called 'End Turn' that when clicked should end the players current turn for the board game the program is based on. I want to some...
I am failing to display a JComponent inside a JPanel on a JFrame.
The following does not work.
JComponent component = ...
panel.add(component, BorderLayout.CENTER);
frame.add(panel, BorderLayout.CENTER);
But if I add the JComponent to the JFrame[like frame.add(component, BorderLayout.CENTER);], it displays the contents.
Any ideas
...
The JTextField is a calculator display initialized to zero and it is bad form to display a decimal number with a leading 0 like 0123 or 00123. The numeric buttons (0..9) in a NetBeans Swing JFrame use append() [below] to drop the leading zeros, but the user may prefer the keyboard to a mouse, and non-numeric characters also need to be ha...