jframe

How to have a JFrame Maximise icon

余生颓废 提交于 2019-12-12 07:08:49
问题 How do i create a JFrame window in eclipse on a Mac that has an icon that makes the window full screen like the double arrow icon on most windows at the top right?? 回答1: Take a look at Fullscreen feature for Java Apps on OSX Lion And Java Runtime System Properties, which may be of interested or How can I do full screen in Java on OSX if those were the wrong feature you wanted UPDATE Lucky for you JFrame extends Window via Frame ... public class TestMacFullScreen { public static void main

TextBox not displaying on frame until the frame is stretched manually

ぃ、小莉子 提交于 2019-12-12 06:10:21
问题 I am trying to create a login page. I wrote code for two textboxes and one button. One textbox next to Username and other one next to Password. One "Sign In" button below. But I am not sure why the textbox's and button are not shown on my output. I only get the Username and password label's on my ouput screen. Strange thing is whenever I stretch my output frame, (I mean either pulling the screen horizontally or vertically) the two textboxes and the button shows up. Please check my code and

Opening a new JFrame and close previous after clicking button

北城余情 提交于 2019-12-12 06:05:15
问题 How can I code a button that, when clicked, closes the current JFrame and opens a new one? This is what I have so far, but the old frame stays open: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { practise1 s = new practise1(); s.setVisible(true); } I have tried using .close() after the first { but it gives me an error. 回答1: If you plan on using the originial JFrame later, use setVisible(false) on the original JFrame. If you plan on closing the first JFrame and never

Update Jlist when new Jframe closing

元气小坏坏 提交于 2019-12-12 05:49:16
问题 I've tried to find some kind of information about my problem with no success, maybe Stackowerflow is to big or I'm using the wrong keywords. Anyway, my problem is that I'm kind a new to Java migrating from the sharp world. I've an project in develop a simple servicedesk software. I've made a JFrame as Startscreen with some buttons and a JList that will display the cases. One of the buttons on the start frame is to create a new case. That button will open a new Jframe where the user can enter

How to use a swing Timer with JPanel

北慕城南 提交于 2019-12-12 05:42:22
问题 I'm fairly sure I understand how a swing timer works, I just cannot figure out how to apply it in my code. The way I apply it in my code doesn't allow it to draw because Graphics g is outside of its scope. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class JayFrame extends JFrame { public JayFrame() { super("My Frame"); setContentPane(new DrawPane()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(1200, 675); setResizable(false); setVisible(true); } class

how to change setIndeterminate jProgressbar in other frame

偶尔善良 提交于 2019-12-12 05:38:58
问题 i have a two frame, frameA and frameB, in frameA i add one button with name buttonA to show frameB and progressbar (setIndeterminate(false)), in frameB i add one button with name buttonB , i want to when i click buttonB, progressbar in frameA.setindeterminate(true) in frameA frameB b; public frameA() { initComponents(); progressbar.setIndeterminate(false); b = new frameB(); } public JProgressBar getProgressbar() { return progressbar; } private void buttonAActionPerformed(java.awt.event

Communicating between JPanels

丶灬走出姿态 提交于 2019-12-12 05:38:47
问题 First off, I'm new to Java, so please be gentle. I have a JFrame which has two 'JPanels', one of which is a separate class (i've extended the JPanel). Ideally I'd like to 'dispatch and event' or notify the other JPanel object on the JFrame. I have an array of JButtons in the custom JPanel class, which i'd like to add an event listener to. Upon clicking the JButton, i'd like to change something on the other JPanel. I'm really not sure how to do this, so I moved the event handler into the

Java - Drawing dissappears when minimizing JFrame

核能气质少年 提交于 2019-12-12 05:38:46
问题 I'm trying to create a paint software, but have ended up with the issue of dissappearing graphics. My class is as following: public class CanvasFrame extends JPanel { private Point lastMousePoint; ArrayList<Point> location = new ArrayList<Point>(); public CanvasFrame() { addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { lastMousePoint = new Point (e.getX(), e.getY()); } }); addMouseMotionListener(new MouseMotionAdapter() { public void mouseDragged(MouseEvent e) {

how to run a applet program from a JFrame application?

▼魔方 西西 提交于 2019-12-12 05:30:09
问题 I am having a JFrame application which is running fine. Now I want to call a applet program from that JFrame application and I don't know how to do it. Please give some suggestions. 回答1: I will suggest you to add the applet in JFrame. Applet is nothing but the component. You can add it in any of the JFrame component. myPanel.add(myApplet); 来源: https://stackoverflow.com/questions/19221544/how-to-run-a-applet-program-from-a-jframe-application

return a variable value to main on button click

血红的双手。 提交于 2019-12-12 05:11:13
问题 I want that main should print hello (in a pop up dialogue box) everytime the button is clicked. So I designed the following program but it doesn't seem to work. The program compiles and executes just fine but when I click the button, I don't see the any dialogue box popping up. I have put in place the getter and setter of the boolean variable (button_clicked) whose value is being tested in the main() block. Please help if you know.. import javax.swing.*; import java.awt.event.ActionEvent;