jframe

Print screen without JFrame

删除回忆录丶 提交于 2019-12-12 02:56:14
问题 I want to do a print screen behind a JFrame who i call source. But the JFrame(source) itself not and print it in another JFrame, who i call destiny... like the picture in the link: https://drive.google.com/file/d/0B4iWj2t4ATQ5ZllwVEE0M1BxUnc/view?usp=sharing I tried to use setVisible(false) and after setVisible(true) but i don't want it closes and open again. How I do it? Here is my actual code: package tests; import java.awt.*; import java.awt.image.BufferedImage; import javax.swing.JFrame;

java JFrame scaled UI display with virtual drawing space

情到浓时终转凉″ 提交于 2019-12-12 02:28:43
问题 i have an application that has graphics which are thought to be displayed at 1024x768. I want to make the application flexible in size without rewriting all drawing code, position calculation etc.. To achieve that my attempt was overriding the paint method of the JFrame container in the following way: @Override public void paint(Graphics g) { BufferedImage img = new BufferedImage(this.desiredWidth, this.desiredHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D gi = (Graphics2D) img.getGraphics(

Bad compile errors for a setup wizard-Cannot find symbol

只愿长相守 提交于 2019-12-12 02:28:12
问题 I am making a setup wizard for a tax application and I get errors that I don't know how to solve. Please help! My Error is: Setup.java:16: error: cannot find symbol Colors = new String[]{"black", "blue", "cyan", "darkGray", "gray", "green", "lightGray", "magenta", "orange", "pink", "red", "white", "yellow"}; ^ symbol: variable Colors location: class Setup Setup.java:17: error: cannot find symbol final JList colors = new JList(Colors); ^ symbol: variable Colors location: class Setup Setup.java

Transferring focus from new jFrame to previous jFrame

£可爱£侵袭症+ 提交于 2019-12-12 02:18:55
问题 I have two JFrames jFrame1 and jFrame2 ,in jFrame1 there's a textfield and a button,while clicking on button jFrame2 will appear. In jFrame2 there's also a textfield and a button.I will type a name in textfield of jFrame2 and by clicking the button in it that textfield value should appear on textfield of jFrame1. But I am not getting the focus transferred to jFrame1,i tried the code, in jFrame1 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling

How to randomly set a JFrame with a simple message

孤街醉人 提交于 2019-12-12 02:12:14
问题 So I've checked out the other post which didn't help on here, I'm trying to get my frame with it's message to randomly appear on an area on the screen but when I run it, it says x and y cannot be resolved to a variable, here's the code: public class MyFrame extends JFrame{ MyFrame(int width, int height, int x, int y){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("R and Ts Main Frame"); setSize(width, height); Random random = new Random(); x = random.nextInt(); y = random.nextInt()

how to escape from full screen mode in java?

…衆ロ難τιáo~ 提交于 2019-12-12 02:09:58
问题 I have used this code to go full screen: private void fullScreenPerformed(java.awt.event.ActionEvent evt) { full = new JFrame(); full.setSize(Toolkit.getDefaultToolkit().getScreenSize()); full.setUndecorated(true); full.setVisible(true); } When I run the program, the JFrame is stuck in the full-screen mode, and I can't close it when I press escape. Thus, I had to restart or log out of my computer to get back to normal screen again. I want the user to be able to close it by pressing the

Change class that extends JFrame to class that extends JPanel

冷暖自知 提交于 2019-12-12 02:08:43
问题 I'm a Java-Newbie an I'm trying to build my first app. I read lots of tutorials and demos and searched for concrete answers to my question but haven't found something that helps. For testing I wrote this class, that connects an access database with a JTable. Now I want to add this Class in a main app but therefore i have to change my exisiting class to JPanel. I tested some changes, but I don't get an output JTable inside my app anymore. Can anybody explain the way I have to change my class?

How to deploy a JFrame in multiple monitor configuration

北慕城南 提交于 2019-12-12 01:55:25
问题 I'd like to build an app that has 2 windows. The first one should always be in the first monitor, and can't be maximized. The second one should be launched in second monitor (a perfect example is like PowerPoint's presentation mode), is running "on top" of any other applications' window, and always maximized. This window is launched using a listener given to the first window. Note that these "monitors" may be LCD projectors used in presentations, or real desktop computer monitors. I know that

Java : using graphics component within an action listener

谁都会走 提交于 2019-12-12 01:43:00
问题 I've made a JFrame with Diferent JButtons and i'd like to get an image from another class. Any ideas? Or how draw on the same class but on the action performed? Because it doesnt let me to do any drawings...my complier always gives me error messages import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.*; public class red extends JFrame { public JButton b; public JButton b1; public JButton b2; public JButton

Java with JFrame and class interaction

左心房为你撑大大i 提交于 2019-12-12 01:41:27
问题 I have two classes in the same Package. The package is called main. Main contains two classes a Main class and a Display class. The display class was created to display a GUI with text boxes and buttons. I gave the buttons a listener that fires when the user clicks one of the button. In the main class is a vector of object that i am storing and need to display one a time in the display class' text boxes. My Question is: can the mouse clicked action call a method in the main class that gathers