Well, I discovered the reason...
One can easily center a JFrame such that its center coincides with the center of the component c that creates it. Simply use the statement...
Type: Posts; User: evert67
Well, I discovered the reason...
One can easily center a JFrame such that its center coincides with the center of the component c that creates it. Simply use the statement...
Thanks. That was useful advice. It was a bit of searching between all the different methods of JFrame and its friends, but I found it.
The location of a JOptionpane (which I use quite a lot) can...
I've managed to teach myself Java and I'm now moving on to Android development. I taught myself Java using a book (Sams Java in 21 days) and I like this a lot better than using online material only....
The title says it all.
I've got a program that uses a few JFrames and JDialogs. The main window is a JFrame and always appears in the top left corner of the screen. The same applies to all other...
Ah, that's it! The done method works. I also just found it in the Oracle docs :-).
Thanks!
Just don't always believe Teach yourself Java in 21 days (a pretty decent book otherwise).
I fire off the GUI as follows:
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ViewController_Graphics view = new...
OK, I understand that classes or objects don't run on threads. I didn't express myself carefully enough. I'm teaching myself Java with two books: Teach yourself Java in 21 days (Cadenhead) and...
Thanks. But I don't understand this.
1) I'd like the user to be able to press a Cancel button before the worker threat has finished. The property change listener is only called after the worker...
In a previous question I asked how I could implement processor-intensive work, which was called by a Swing component, without the GUI locking up. I was then pointed to the SwingWorker class. I...
Thanks. I'll read more about SwingWorker.
Just to be sure. My UI code (class ViewController_Graphics) is invoked as follows:
SwingUtilities.invokeLater(new Runnable() {
...
I am writing a program to solve Sudoku puzzles. My user interface is written in Swing.
When a user presses a "Solve" button, an ActionListener for this button is called. This ActionListener...
I already messed with the code. What I found out is that the code actually works as if the first repaint removes the red box: if you remove that line, the red box remains displayed also at its old...
Do I also need to use the above code (explicitly put the Swing code on the EDT) if my entire program runs in one threat, i.e. my program never explicitly creates any threats?
Thanks, this clarifies it a bit. But what I still don't understand is how the first invocation of repaint causes the red box to be wiped out.
As I wrote in the other topic: are these forums somehow connected and, if so, is there a preferred place?
Yup. Are these forums somehow connected and, if so, is there a preferred place?
According to what I read, “when programming in Swing, your GUI creation code should be placed on the Event Dispatch Thread (EDT). This will prevent potential race conditions that could lead to...
I’m teaching myself AWT/Swing using an Oracle tutorial. There’s a section a don’t fully understand.
It concerns an application that creates dynamic graphics using the Graphics class. I understand...
Yes, I read that later. Which is the preferred method, override getPreferredSize() or use setMinimumSize() ?
Thanks a lot! It works!
I am writing a program to solve Sudoku puzzles. I create the user interface using AWT/Swing.
One panel of the main window (JFrame object) contains a Graphics2D component only (a grid for the...
Thanks both! Very useful information!
I’m teaching myself Java. I am a fairly proficient programmer in other languages, but this is the first OO language I’m doing.
I have a question that is a bit hard to summarize. Or it should be:...
Thanks all! I've started learning Java using Notepad++ :-) .
I will be using Eclipse in some time, though. The reason is that I want to do Android programming.
Does anyone know of a good and...
Hi all,
I'm Evert, born in 1967 as the name says :-) .
I want to teach myself Java. Should be possible, since I have plenty of experience in other programming languages.
Since I want to use...