jframe

JFrame Glasspane is also over JDialog but shouldn't

谁都会走 提交于 2019-12-20 06:28:27
问题 I have a JFrame (undecorated) with a Glasspane. This Frame opens a JDialog (also undecorated and has also a glassPane) and hides itself (setVisible(false)). The Glasspanes are set with .setGlassPane(). The Dialog is opened with the Frame as owner. The GlassPane extends a JPanel and implements AWTEventListener. I use it for resizing the Frames and Dialogs, so it knows it's parent (the Frame/Dialog) - this is called "target". The Events inside the GlassPane are handled like this: public void

Forcing JFrame to not resize after setResizable(false). Command wont work

余生长醉 提交于 2019-12-20 06:21:46
问题 I have a simple Atari breakout program, and long story short, one of my powerups is to allow the user to resize the window for a few seconds, then make the window non-resizable again.Everything works fine, and the window goes from being not-resizable, to being resizable for a few seconds. What's supposed to happen, is after the few seconds are up, the window should stop accepting input for resizing the window (IE: should not be resizable). The only problem, is that whenever it's supposed to

How to paint an invisible JFrame elsewhere?

主宰稳场 提交于 2019-12-20 05:41:38
问题 I want to paint the contents of a JFrame onto another frame. Currently, I only get it to work if the JFrame is visible. Is there a way to paint a hidden JFrame? Additional info: In my project I need to be able to rotate and scale windows. I do not want to write my own window-api, so I thought I might be able to just paint JFrames or similar container classes in a rotated way (which the Graphics2D-API supports perfectly well). It would be awesome to be able to use standard JFrames for that,

ActionListener isn't Implementing

霸气de小男生 提交于 2019-12-20 04:17:25
问题 JFrameWithPanel is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener public class JFrameWithPanel extends JFrame implements ActionListener I Don't get this code. Book and Java site tells me this is the syntax for the method, but again this error shows up constantly. import javax.swing.*; import javax.swing.JOptionPane; import java.awt.*; import java.awt.event.*; import java.lang.Math.*; import java.lang.Integer.*;

JFrame very small using null layout

不羁岁月 提交于 2019-12-20 04:15:45
问题 Hi I am writing a simple program to display a frame. However the frame turns out real small when I type setLayout(null); But if i ignore this command, the button is always at the top center Can some one point out my error? import java.io.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; class theframe { private static void create() { JFrame frame = new JFrame("FrameDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Insets insets = frame.getInsets(); frame.setSize

disposing frame from swingWorker

左心房为你撑大大i 提交于 2019-12-20 04:03:07
问题 actually i have called the swing worker from a frame (Suppose) A.. in the swing worker class in do-in-Background method i have certain db queries and i am calling frame B too.. in the done() method however i want to dispose the frame A.. how can i do that..? i cannot write dispose() in frame A class because that results in disposing of frame before the new frame(frame B) is visible... Please help!! class frameA extends JFrame{ public frameA(){ //done some operations.. SwingWorker worker=new

Mechanisms of setText() in JTextArea?

蹲街弑〆低调 提交于 2019-12-20 03:42:19
问题 I try to show some text in my JTextArea in runtime. But when I use a loop of setText to show text in order, it only show the text of the last loop Here is my code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { for (int i=0;i<10;i++) jTextArea1.setText("Example "+i); } I want it to show "Example 1", "Example 2",..,"Example 9" . But it only show one time " Example 9 " Anyone can explain it for me?? 回答1: setText does just that, it "sets the text" of field to the value

Reading all new messages from my gmail using javamail

故事扮演 提交于 2019-12-20 03:24:12
问题 I have an application which contains a GUI, it is using Javamail. When i open this Jframe I have to see messages that are sent to my mail on a jTextArea . The problem is when i wrote my code it only shows just the last message sent. How do I display all new messages in my inbox? This is my code : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Properties props = new Properties(); props.put("mail.pop3.host", "pop.gmail.com"); props.put("mail.pop3.user", "mymail@gmail.com

How to make a modal JFrame? [duplicate]

此生再无相见时 提交于 2019-12-20 03:21:44
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How to make a JFrame Modal in Swing java I have 2 JFrames one is the main JFrame and the other one is a sub JFrame, and I'm trying to make the main JFrame inaccessible to user interactions when I display the sub JFrame. 回答1: How to make a modal JFrame? Don't. Use a modal JDialog -- that's precisely what they're for. You understand of course that a JDialog can hold a complex GUI, as complex as any held by a

How to make a modal JFrame? [duplicate]

左心房为你撑大大i 提交于 2019-12-20 03:21:20
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How to make a JFrame Modal in Swing java I have 2 JFrames one is the main JFrame and the other one is a sub JFrame, and I'm trying to make the main JFrame inaccessible to user interactions when I display the sub JFrame. 回答1: How to make a modal JFrame? Don't. Use a modal JDialog -- that's precisely what they're for. You understand of course that a JDialog can hold a complex GUI, as complex as any held by a