jframe

Maximizing a JFrame on action?

女生的网名这么多〃 提交于 2019-12-23 02:28:16
问题 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 me how I need to edit my code to pull this off, it would be greatly appreciated. Thanks! import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax

Java - My action event doesn't work

▼魔方 西西 提交于 2019-12-23 02:22:14
问题 I'm learning Java and Swing, but my JButton doesn't work. import javax.swing.JFrame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Programma { public static void main(String[] args) { // TODO Auto-generated method stub try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e){ e.printStackTrace(); } JFrame frame = new JFrame("DIG"); JPanel panel = new JPanel(); JButton button = new JButton(

Java fullscreen jframe with dual monitor

你离开我真会死。 提交于 2019-12-22 18:36:52
问题 Here my issue, I have 2 Jframe, one for controlling and one for displaying things to publics. I need the display frame to be in fullscreen to avoid publics see things it doesn't need, and I need the controling frame to be usable on the other screen to control the display frame. Here's my problem, today, I have no problem working this way in Ubuntu and a dual screen mode, but, in Windows 7 buisness 64 (don't try other version yet) The display frame actually goes fullscreen, but when i click

How to clear/ reset a JFrame

巧了我就是萌 提交于 2019-12-22 12:37:20
问题 Me and my friend have decided to work on a card game which cycles between 3 screens ( Player1HandScreen, Player2HandScreen and FightScreen ). Once Player1 has chosen their card from Player1HandScreen , Player1HandScreen leads to Player2HandScreen where Player2 does the same. then Player2HandScreen leads to FightScreen where the two cards are compared and one player is declared the winner of that round. The problem we are having is that once the round ends we want to clear Player1HandScreen as

How to set position of objects in JFrame?

余生长醉 提交于 2019-12-22 11:17:09
问题 I have Labels and JButtons i want to define the position in JFrame. import java.awt.*; import java.net.InetAddress; import java.net.UnknownHostException; import javax.swing.*; public class GuiFrame extends JFrame { public static void main(String[] args) throws UnknownHostException { JFrame f = new JFrame("This is a test"); f.setSize(400, 150); JRadioButton ButtonServer = new JRadioButton("Server"); JRadioButton ButtonClient = new JRadioButton("Client"); InetAddress thisIp = InetAddress

JFrame whose content changes as we click on the different buttons

你。 提交于 2019-12-22 10:55:24
问题 I am using Java's Swing here to make a UI application. I have a created a JFrame, with some buttons. When I click on this button, I want a new JFrame with some different content at this place. However, I do not want a new JFrame to load here. One approach, I know is of setting the visbility of the second JFrame to be True in the actionPerformed(ActionEvent obj) method of the button in the first JFrame. But it again loads a new JFrame and I don't want that. public class FirstUI extends JFrame

Transparent JFrame/JWindow on Mac OSX with Java 7

倾然丶 夕夏残阳落幕 提交于 2019-12-22 10:53:21
问题 We have a screen sharing applet that opens up a Swing JFrame and uses the Robot class to capture the screen behind the empty frame. The user is able to click through the frame and interact with whatever lies behind the applet. This works fine on Windows and used to work with Apple's Java version, but with Java 7 for Mac it does not work. Mouse clicks does not go through the JFrame. The JFrame uses: setAlwaysOnTop(true); setUndecorated(true); Tried using: AWTUtilities.setWindowOpaque(false);

How to add text to JFrame?

杀马特。学长 韩版系。学妹 提交于 2019-12-22 04:42:22
问题 So I am designing a JFrame using Eclipse WindowBuilder. This specific frame is an error message stating that the user provided invalid credentials. I have added a button to exit the frame and I now need to display the actual error message "The login credentials specified are invalid. Please provide valid credentials." I have done some searching and everyone says to use a JLabel, but when I create my JLabel and enter the text to it, there is no wordwrap or anything so I can't fit the label

How to add text to JFrame?

ぐ巨炮叔叔 提交于 2019-12-22 04:42:13
问题 So I am designing a JFrame using Eclipse WindowBuilder. This specific frame is an error message stating that the user provided invalid credentials. I have added a button to exit the frame and I now need to display the actual error message "The login credentials specified are invalid. Please provide valid credentials." I have done some searching and everyone says to use a JLabel, but when I create my JLabel and enter the text to it, there is no wordwrap or anything so I can't fit the label

System.exit(0) vs JFrame.EXIT_ON_CLOSE

故事扮演 提交于 2019-12-22 03:51:22
问题 Is there any difference between the two. I was reading an article ( http://www.javalobby.org/java/forums/t17933 ) about that you should always use System.exit(0); Currently I use JFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); The article says that even for a Java Swing Application you should add a listener WindowAdapter and and call System.exit() inside its method windowClosing(WindowEvent e) . Is there any difference? Is one method better then the other? 回答1: If you look at the