jframe

Java attach JFrame to a running application window?

自闭症网瘾萝莉.ら 提交于 2019-12-06 08:19:08
How can I attach a JFrame in the top right to another applications open window and stay with it while resizing? Is it possible? Here is a diagram of what i would like to accomplish: Thanks for the help! If this is not possible, are there alternatives ? Ways to get window size/location and set my own jframe accordingly? You are asking Java to modify an already running non-Java program, and for these types of problems, Java is not the best tool. Please understand that one of Java's main strengths is its ability to run compiled code unchanged on multiple platforms. With this strength comes a

Make a Java application invisible to a user

我与影子孤独终老i 提交于 2019-12-06 07:31:33
I'm trying to figure out a way to make a Java application invisible to the user. Basically just trying to remove this <- Image How can this be done? public class TransparentWindow extends JFrame { public TransparentWindow() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { setExtendedState(Frame.MAXIMIZED_BOTH); setResizable(false); setUndecorated(true); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setAlwaysOnTop(true); System.setProperty("sun.java2d.noddraw", "true"); WindowUtils.setWindowTransparent(this, true); WindowUtils.setWindowAlpha

JFrame freezes during while loop [duplicate]

佐手、 提交于 2019-12-06 07:13:55
This question already has answers here : Running a JFrame with a JProgressBar (2 answers) Closed 6 years ago . I am working on a Java program, which reads text files does some probability calculations. Reading files and all related calculations are done in a while loop. I had created a GUI using JFrame, where i had added a Progress bar (using JProgressBar) to show the progress since the program takes a while to process the files. The code looks like - while( there are more files to read ) { Read this file ; Do calculations ; Update progress bar ; } Now, the problem is once the while loop

How to clear/ reset a JFrame

旧城冷巷雨未停 提交于 2019-12-06 05:26:50
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 well as the Player2HandScreen once refreshing our parameters we are having trouble updating the GUI

How to deploy swing application on web browser?

…衆ロ難τιáo~ 提交于 2019-12-06 05:11:30
问题 I have a big swing application that I have developed. There are several classes that each creates its own JFrame while closing the previous one which called this class. I wish to deploy this into a web browser and understand that I need to convert it to an applet. Do I have to add in code for creating applet in each of these classes? or is there some other way. In my current situation each of the class creates a JFrame which has some buttons which on being clicked will close the current

JFrame GridBagLayout component positioning

为君一笑 提交于 2019-12-06 03:28:35
So, I was using null layout but was told it was a terrible idea and so decided to use GridBagLayout, as it's supposedly the easiest to customise. I'm having trouble with positioning my components, I am really confused as to how I can get a label to the top middle of the screen, my table in the middle, and my login button to the bottom right. Does anyone know how to do this? Here's my code: import javafx.geometry.HorizontalDirection; import javax.swing.*; import javax.swing.table.DefaultTableModel; import java.awt.*; import java.awt.event.*; public class Main { JFrame window = new JFrame("PE

JFrame whose content changes as we click on the different buttons

本秂侑毒 提交于 2019-12-06 03:12:17
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 { JButton but1; public FirstUI(){ but1= new JButton("Click here"); add(but1); XYZ obj= new XYZ(): but1

Trying to display URL image in JFrame

守給你的承諾、 提交于 2019-12-06 02:51:33
问题 Trying to display a URL-image in a JFrame window. If this works correctly, when the program runs, a window should open displaying an image. Trying to experiment with URL's and hard-drive paths. import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.*; class ImageInFrame { public static void main(String[] args) throws IOException { String path = "http://chart.finance.yahoo.com/z?s=GOOG&t=6m&q=l"; URL url = new URL

Transparent JFrame/JWindow on Mac OSX with Java 7

会有一股神秘感。 提交于 2019-12-06 01:49:04
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); Or setBackground(new Color(0, 0, 0, 0)); With Apple's version the: getRootPane().putClientProperty(

Can't Edit JFrame Form after NetBeansUpdate

可紊 提交于 2019-12-06 00:29:08
Lately, I've been working on a project in NetBeans using the GUI editor that's built in. Before I noticed that it generated an XML ".form" file that didn't appear in the Project Explorer Pane which makes sense. Earlier I was working on the form in the "Design" tab when it notified me about 15 updates. I just updated without reading anything which was probably a bad idea but when I restarted the IDE, it showed my GUI ".class" file and ".form" file separately in the Project Explorer and I couldn't switch between "Source" and "Design". I also noticed that the generated code that was usually not