jframe

JList update freezes display but not JFrame setTitle

情到浓时终转凉″ 提交于 2019-12-11 10:17:48
问题 If I update a JList with a long number of html formatted items then the controls stop responding and indicators won't update. This makes sense, the event thread is busy. The title can still be set though. Why is this? Here's some (long) code demonstrating this: import java.awt.*; import java.awt.event.*; import java.lang.reflect.InvocationTargetException; import java.util.Timer; import java.util.TimerTask; import javax.swing.*; public class JListTest extends JFrame { class TestListModel

Java Jframe launch another JFrame to another X Server

房东的猫 提交于 2019-12-11 09:57:49
问题 I have java application which is runs on Xvnc (on Ubuntu) screen (DISPLAY :1), what I need to do is, to launch another JFrame to main screen DISPLAY :0 from one application, that is, the one running in DISPLAY :1. I have think about using Runtime.getRuntime().exec(), but the problem is, i need to control the second JFrame properties from the main application. Please help on how can I achieve that. Thank you. I don't need cross platform solution, just for ubuntu. UPDATE: i used code try{

Modal Window on top of Modal Window in java swing?

懵懂的女人 提交于 2019-12-11 09:47:54
问题 I have the following problem: I have a main application window (JFrame) that fills the whole screen. When a button is clicked, a smaller window appears, to let the user input some Data. While the User does this, the main window should neither jump in front of it, nor allow interaction. Solution to that: open a modal JDialog. Lets call that Dialog 1. But when a button within this Dialog is clicked, a NEW window (yes/no-dialog) is supposed to pop up.. and, again, needs to act modal on the

Problems with detecting mouseClick in a JPanel and preventing circle from painting in JPanel

喜欢而已 提交于 2019-12-11 09:27:25
问题 My current program lets the user move a circle around the JFrame and also change its color by pressing one of the colors presented in the JPanel at the bottom of the JFrame. My code: import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.border.Border; import javax.swing.BorderFactory; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.Color; import java.awt.Graphics;

How to fill a jframe table from an arraylist?

徘徊边缘 提交于 2019-12-11 09:26:51
问题 I have a jtable that I created using java GUI and I need to fill from an arraylist. I'm not familiar with java and I have no idea how to fill a jTable. I don't know if I need to use TableModel or just JTable table = new JTable(data, columnNames). This is my code: public void filltable(){ ArrayList A=new ArrayList(); jframe4 j=new jframe4(); String m=j.getloggedemail(); // A=s.getEmails(m); //this is an example of my arraylist A.add("sender@gmail.com"); A.add("my subject"); A.add("hiiii"); try

Modal dialog not always on top of an undecorated JFrame when another JFrame is visible

别等时光非礼了梦想. 提交于 2019-12-11 09:09:46
问题 I have a weird problem with modal dialogs and undecorated JFrame . If I create a main undecorated JFrame then I display a modal dialog thanks to the JOptionPane , everything goes well. The modal dialog stays always on top and I can't click on the main fame. But, if create another JFrame (or another JDialog ), the modal dialog still prevent me to interact with the main frame, but now the modal dialog is not always on top and go underneath the main frame when I click on it. This problem doesn't

JButton orientation within a JPanel

一个人想着一个人 提交于 2019-12-11 08:56:32
问题 I am designing a GUI for an image editor in which I have multiple buttons which apply different effects to the selected image. Currently I have the Display button in the top center of the window, the Load button in the bottom center of the window, and I want the effect buttons stacked on the left side of the window. Here is the image of my GUI, with the ButtonPanel JPanel in red, the FileChooser JPanel in green, and the ImageDisplay JPanel in blue: As you can see, the buttons in the

JFrame Back Ground Image that other buttons don't appear on frame when background image is set? [duplicate]

谁说我不能喝 提交于 2019-12-11 08:28:40
问题 This question already has answers here : Setting background images in JFrame (4 answers) Closed 4 years ago . I want to add a background image to my frame.But when i add an image to my frame it was added successfully but other things like j label and buttons added on frame afterwords don't appear on frame. i have kept image on Desktop. below is my code package UI; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Color; import java.io.File; import javax.imageio.ImageIO

Cannot create multiple polygons in Java - only one

北城余情 提交于 2019-12-11 08:27:53
问题 Given the following code : import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import java.util.Iterator; import javax.swing.JFrame; import javax.swing.JPanel; /** * * @author X2 * */ public class PolygonnerJframe { public static void main (String[] args) { JFrame frame = new JFrame("Draw polygons"); frame

JFrame Will Not Close

心不动则不痛 提交于 2019-12-11 08:20:10
问题 At the moment, I am working on a version of Conway's Game of Life for my own amusement. Up to this point, everything has gone smoothly, but just as I was testing some of the final parts, I noticed an irritating error. The main body of the code takes place inside of a while loop that is controlled by the number of 'generations' of the game the user would like see. While this loop is executing, the JFrame's red X refuses to respond and I am at a loss as to why this is. Area where I am