Skip to content
Advertisement

Tag: swing

Java quiz with multi choices in answers

I’m trying to develop a java quiz, here’s the basic idea: A quiz contains n questions, and a question has 0 to n true answers, I have to link that to a database, so my tables are: Table Quiz: Table Question: Table answer: So my java classes are: My Question class: and the same for Answer: The main JFrame contains

Is there anyway to get the size of the text in a JTextArea?

The title pretty much says it all. What I don’t mean is how to get the size of the JTextArea. I need to get the size of the actual text. I am completely open to suggestions though. If you have a wonky workaround that involves using something other than JTextArea but still has a similar effect, I’d love to hear

JTextField size can’t be changed

} I tried to create a form and a JTextField on it. But the problem is, my location and size doesn’t work. The TextField is filling the whole form. How can I fix it? Answer The size is not “working” due to the default layout (FlowLayout) in your JFrame. This layout doesn’t let you change the size or location of

Performance of JavaFx Gui vs Swing

I wrote two simple programs, both draw the same Sierpinski Triangle: One program was implemented using swing, and one using javafx. There is a very significant performance difference, swing implementation being consistently much faster: (In this test case : Swing over 1 sec. Javafx over 12 seconds) Is it to be expected or is there something very wrong with my

JPanel takes the entire space of JFrame

I am struggling to place some simple objects using the FlowLayout manager in Swing. Basically I have created a small program, I have set up the size of the frame, then crated some JLabels and then one JPanel. I have put the JPanel a setSize of 300×300 and changed it’s color to red to visually see it. However it takes

JavaFX WebView in Java Swing Project

i try to use the WebView in my java project, in my code is: but the this thown a exception And yes, this is not a JavaFx application. Answer You can embed JavaFX content into a Swing application using JFXPanel. Note that for this to work correctly, you have to be careful to create and access the Swing content on

Latency in Iterator or foreach

i have one ArrayList that has a 1000 Insert SQL statement. but rather in execution time the latency of Iterator or (enhanced for loop) for this ArrayList take 1 minute . and my JFrame is not responding in this period. what can i do? Thanks Answer foreach internally uses iterator only, in order to handle bulk updates and inserts from

Advertisement