jframe

JFrame and Nimbus Look And Feel

。_饼干妹妹 提交于 2019-12-18 18:05:21
问题 I use Nimbus Look and Feel in a project. However, although every GUI JComponent have a Look and Feel of Nimbus, JFrame always have Windows Look and Feel. How can JFrame have Nimbus Look And Feel? Edit: Operating System : Windows XP 回答1: Try using this: JFrame.setDefaultLookAndFeelDecorated(true); //before creating JFrames For more info., see How to Set the Look and Feel in the tutorial. import javax.swing.*; class FrameLook { public static void showFrame(String plaf) { try { UIManager

Does disposing a JFrame cause memory leakage?

家住魔仙堡 提交于 2019-12-18 15:53:10
问题 I am writing a test program as follows: When a user clicks button A, it opens 50 JFrames. When the user clicks button B it disposes all JFrames shown by clicking button A. I find that the memory does not decrease after clicking button B. I determined this using the Task Manager, ctrl + alt + del in Windows, and checking the memory usage of "java". 回答1: That's right, no way, not able to solve that (not only in Java PL), 1) really don't create lots of Top-Level Containers on Runtime/Fly,

How to change java icon in a JFrame

十年热恋 提交于 2019-12-18 13:15:33
问题 Ok so I've been researching this one quiet a bit. I am fairly new to java but thought that this one would be easy. Ive tried just about every way that has been answered on this site and still no luck, and usually when I look here I am able to find a answer that fits what I am looking for. Does anyone know how to change the Java icon in the top corner of the JFrame. I'm pretty positive that its not my file path either because all my images are in the same folder and they all work, this is the

Open JFrame, only after successfull login verification with database. Using Eclipse?

若如初见. 提交于 2019-12-18 09:53:05
问题 what I'm trying to do is open up a main application from a login screen, only after the login information has been verified in the connected database. Using Eclipse, what I have so far: database.java : connection to MS Access Database using UCanAccess. (Success) login.java : A login window that extends JFrame. When a username and password is entered, it is verified with the database. (Success) Home.java : The main application window, that I want to only be accessible with a correct username

Insert JFrame into a Tab in Swing

♀尐吖头ヾ 提交于 2019-12-18 09:41:53
问题 I Have an already given JFrame frame , that I want to show it (insert it) into a tab of JTabbedPane , but that was not possible explicitely like that: frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainTabs.addTab("Editor", null, frame, null); And the error was: java.lang.IllegalArgumentException: adding a window to a container I tried some solutions like to insert the frame into a JPanel but also in vain. I have the idea to

Disposing JFrame by clicking from an inner JPanel

天大地大妈咪最大 提交于 2019-12-18 09:33:48
问题 I'm trying to dispose my JFrame by clicking a button, located on a JPanel that is placed on the JFrame that I want to close. I tried to make a static method on the JFrame class, but ofcourse my IDE told me that wasn't going to happen. Anyone thinking of a solution? Thanks! 回答1: Try this: public class DisposeJFrame extends JFrame{ JPanel panel = new JPanel(); JButton button = new JButton("Dispose JFrame"); public DisposeJFrame(){ super(); setTitle("Hi"); panel.add(button); add(panel); pack();

Add values when JCheckBox clicked

别等时光非礼了梦想. 提交于 2019-12-18 09:33:46
问题 My program contains a label with the caption “Choose a coffee” and four check boxes – Americano, Espresso, Double Espresso and Latte. Note: A JCheckBox array is recommended here) I need to add event handling code to allow the user to purchase one or more items. The bill amount is displayed in a label after the user has made their selections. The prices are Americano €3.75, Espresso €4.00, Double Espresso €4.50 and Latte €3.50. An array is suitable here also. As the user makes a choice a label

Dynamically resize jframe/image or scroll

时间秒杀一切 提交于 2019-12-18 09:12:24
问题 As discussed in this question (Wrap image to Jframe), i need a jframe to match the exact provided image (The image itself is originally a PDF which has been converted to an image) The solution provided does indeed build a jframe to my image dimensions, but i can't actually see all of the image. I need to be able to resize the jframe, with the image dynamically adjusting to the new jframe size. Failing that, i think if i could just scroll the jframe or even zoom in or out, i could at least get

More than one JPanel in a Frame / having a brackground Image and another Layer with Components on the top

試著忘記壹切 提交于 2019-12-18 09:05:27
问题 I've got a JFrame with a JPanel in which there is a JLabel with an ImageIcon(). Everything's working perfectly, problem is i now want to add another JPanel with all the other stuff like buttons and so on to the JFrame. But it still shows the background Image on top and nothing with the second JPanel. Can someone help me? Here is an extract of my code: JFrame window = new JFrame("Http Download"); /* * Background Section */ JPanel panel1 = new JPanel(); JLabel lbl1 = new JLabel(); /* *

More than one JPanel in a Frame / having a brackground Image and another Layer with Components on the top

对着背影说爱祢 提交于 2019-12-18 09:04:08
问题 I've got a JFrame with a JPanel in which there is a JLabel with an ImageIcon(). Everything's working perfectly, problem is i now want to add another JPanel with all the other stuff like buttons and so on to the JFrame. But it still shows the background Image on top and nothing with the second JPanel. Can someone help me? Here is an extract of my code: JFrame window = new JFrame("Http Download"); /* * Background Section */ JPanel panel1 = new JPanel(); JLabel lbl1 = new JLabel(); /* *