jframe

JFrame to be displayed when the event occurs?

穿精又带淫゛_ 提交于 2020-01-06 04:53:06
问题 I have a JFrame which pops up when the event occurs. I am having a functionality which when the event occurs the JFrame pops up and if we click on that Frame it will open the corresponding frame, but the issue is when I am not clicking the popped up frame when the event occurs, if another event comes its displays the frame in the taskbar in a blinking state but not in an open state, I want to display the frame as it is without the frame blinking in the taskbar???? Any suggestions??? 回答1: I

JFrame questions

纵然是瞬间 提交于 2020-01-06 04:31:30
问题 I have some questions regarding JFrame. Here's the scenario: I have made some object classes in java and I want to make the GUI for these objects. So i created 2 JFrames. One JFrame manipulating these different classes and the other JFrame manipulating the first one. The first JFrame i'll call it "TypesGUI". It manipulates differents instances of animals (Lion, tiger etc). The second JFrame i'll call it AnimalGUI. Now AnimalGUI is just JFrame that contains menus and textareas. In one of the

Keep JFrame on top of others

你说的曾经没有我的故事 提交于 2020-01-05 13:27:30
问题 I am in a situation where I create a frame FrameB from my main frame FrameA . When the user is working on FrameB I would like it to be on top of FrameA even when the user accidentally clicks on FrameA . 回答1: Do you have to use a JFrame? If you use a JDialog instead of a JFrame and assign FrameA as the owner of the dialog through the constructor it will always remain on top of the frame. (Example: How to set the JFrame as a parent to the JDialog) Otherwise you can use setAlwaysOnTop() from the

Continue code execution after new JFrame is created and then closed

家住魔仙堡 提交于 2020-01-05 09:05:27
问题 So this is probably a silly question but I just cant figure it out. Basically I have my MainWindow, when I press a button a new window should appear named PartSelectionWindow that contains a JTable (the JTable is filled out with a custom table model). Then I select a row and press ok to go back to the MainWindow and work with the info selected. Here's the problem: If I use a JFrame for the PartSelectionWindow, after the window is closed the code execution does not continue in the MainWindow

Paint Swing Component to PDF using iText

我怕爱的太早我们不能终老 提交于 2020-01-05 08:57:23
问题 I have a JFrame, which i wish to save as a PDF. How do i paint this JFrame using iText? public PrintFrameToPDF(JFrame bill) { try { Document d = new Document(); PdfWriter writer = PdfWriter.getInstance(d, new FileOutputStream ("sample.pdf")); d.open (); // HOW ? d.close (); } catch(Exception e) { // } } 回答1: This should do the trick (and it's generic for JComponent object): public PrintFrameToPDF(JFrame bill) { try { Document d = new Document(); PdfWriter writer = PdfWriter.getInstance(d, new

Paint Swing Component to PDF using iText

末鹿安然 提交于 2020-01-05 08:57:07
问题 I have a JFrame, which i wish to save as a PDF. How do i paint this JFrame using iText? public PrintFrameToPDF(JFrame bill) { try { Document d = new Document(); PdfWriter writer = PdfWriter.getInstance(d, new FileOutputStream ("sample.pdf")); d.open (); // HOW ? d.close (); } catch(Exception e) { // } } 回答1: This should do the trick (and it's generic for JComponent object): public PrintFrameToPDF(JFrame bill) { try { Document d = new Document(); PdfWriter writer = PdfWriter.getInstance(d, new

Trying to draw multiple polygons results in error

泪湿孤枕 提交于 2020-01-05 06:45:07
问题 Following my previous post here , I changed the code to : PolygonnerJframe.java 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)

Trying to draw multiple polygons results in error

大兔子大兔子 提交于 2020-01-05 06:44:41
问题 Following my previous post here , I changed the code to : PolygonnerJframe.java 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)

How to embed a windows program inside java component

Deadly 提交于 2020-01-05 04:39:05
问题 I have done a little research online with no luck, and I cant seem to see a question on SO similar to this. I wanted to know if its possible to place a windows program to fit inside a jFrame or jWindow. The particular example I had in mind was if I were to create a jFrame, can I spawn a windows program to open (i.e. cmd.exe) and embed that window within my jFrame somewhere. Hopefully the following image depicts what Im trying to acheive. 回答1: This has been asked before several times on this

Why are graphics not appearing in JFrame?

倖福魔咒の 提交于 2020-01-05 04:33:10
问题 Below I included two of the classes in my Java program (Launcher and Controls). In the both classes, they create a JFrame, draw a background image, and add lines of text. I have looked at the code over and over, but for some reason the background image and the line of text are not appearing in the second class (Controls). Could anyone please explain to me why this is happening? Launcher Class: import hungerGames.Display; import hungerGames.RunGame; import hungerGames.input.InputHandler;