jframe

Why JMenuBar is not place in the JFrame content pane, but JToolbar place in the content pane

。_饼干妹妹 提交于 2020-01-19 17:58:05
问题 Why JMenuBar is not place in the content pane?is there any reason or effects when make a java gui program especially when using jframe? Thanks 回答1: As stated in Using Top-Level Containers article, the manu bar is managed by the Root Pane: Each top-level container relies on a reclusive intermediate container called the root pane. The root pane manages the content pane and the menu bar, along with a couple of other containers. You generally don't need to know about root panes to use Swing

Java Fullscreen mode not working on Ubuntu

拜拜、爱过 提交于 2020-01-19 12:56:09
问题 So I'm using Ubuntu and when I want to enter fullscreen mode in Java, a normal window appears with max screen size, instead of a fullscreen window without title bar etc. I admit, I'm not even sure what the fullscreen mode should look like in Java, because I have not tried it on any other OS. But I assume it should be a screen without title bar. Anyone else who has this problem? This is the code I use. ; pretty straight forward. public static void main(String[] args) { GraphicsEnvironment env

Java Fullscreen mode not working on Ubuntu

心不动则不痛 提交于 2020-01-19 12:54:48
问题 So I'm using Ubuntu and when I want to enter fullscreen mode in Java, a normal window appears with max screen size, instead of a fullscreen window without title bar etc. I admit, I'm not even sure what the fullscreen mode should look like in Java, because I have not tried it on any other OS. But I assume it should be a screen without title bar. Anyone else who has this problem? This is the code I use. ; pretty straight forward. public static void main(String[] args) { GraphicsEnvironment env

Incorrect position of Swing components

空扰寡人 提交于 2020-01-17 14:17:08
问题 I woud like to have button btn at the bottom of a JFrame . I have this in right side. Where is bug in my code? class MainClass extends JFrame { private JSplitPane splitPan=null; private void treePanel(){ DefaultMutableTreeNode nod=new DefaultMutableTreeNode("AAA",true); nod.add(new DefaultMutableTreeNode("abcd")); JTree tree=new JTree(nod); JScrollPane scroll=new JScrollPane(tree); splitPan=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,scroll,new JLabel("aaaaa")); splitPan.setSize(this

Close JFrame without closing my whole project [duplicate]

♀尐吖头ヾ 提交于 2020-01-17 13:45:10
问题 This question already has answers here : Close one JFrame without closing another? (2 answers) Closed 3 years ago . Hi this problem is a little bit big.. I started my first big Java Project and right now I do not know how to close a JFrame without closing my whole project. This are my project files: https://drive.google.com/open?id=0BxIXktk4GMkIMnd6ZXlLQnBHem8 I tried everything to close the JFrame loginRegisterWindow but with everything I tried the Frame stayed open .. Has anyone a specific

Send data to previous JFrame

橙三吉。 提交于 2020-01-17 12:39:08
问题 I am working with JFrames, I have a main JFrame, which calls for a second JFrame (jFrame2 for example). I need at that jFrame2 has 9 buttons with images within each button (UP HERE ALL PERFECT). Then when in the jFrame2 press a button, close the jFrame2 and send a string to jFrame1. the jFrame1 must be waiting for the end jFrame2 to receive the string that sends the jFrame2, and since the jFrame1 send a JSON to the server with that string. This is my example code: ////// class jFrame1 //////

Send data to previous JFrame

允我心安 提交于 2020-01-17 12:38:00
问题 I am working with JFrames, I have a main JFrame, which calls for a second JFrame (jFrame2 for example). I need at that jFrame2 has 9 buttons with images within each button (UP HERE ALL PERFECT). Then when in the jFrame2 press a button, close the jFrame2 and send a string to jFrame1. the jFrame1 must be waiting for the end jFrame2 to receive the string that sends the jFrame2, and since the jFrame1 send a JSON to the server with that string. This is my example code: ////// class jFrame1 //////

Java how to put a button on border/surround of window or JFrame

梦想的初衷 提交于 2020-01-16 23:36:33
问题 How do I put a button on the border that surrounds the frame like this cog: 回答1: _"Is the a short example anywhere? " Yea, here... This very basic. You need to do alot more to it. You'll notice I have to add a MouseMotionListener to the JPanel that acts as the top frame border, because when you remove the decoration from the frame, you're also taking away that functionality. So the MouseMotionListener makes the frame draggable again. You would also have to implement resizing if you wished. I

How can I add an elliptical border to a JFrame

拥有回忆 提交于 2020-01-16 11:29:06
问题 I have an undecorated JFrame in the shape of an ellipse, that I would like to add a border. I am hoping I don't have to implement the rootPane.paintComponent method, and that I can just do this by adding a border. Is this possible in Java 7 or 8? 回答1: In your implementation of paintComponent() , use setClip() with an Ellipse2D sized to match the image's width and height . private Ellipse2D.Double border = new Ellipse2D.Double(); … public void paintComponent(Graphics g) { super.paintComponent(

Create Scroll Bar for JFrame

余生长醉 提交于 2020-01-16 01:06:12
问题 Hi I am trying to create Scroll Bar for my JFrame. I created JPanel object and set components into JPanel. Then created a JScrollPane object for the panel. Then add the ScrollPane object to JFrame. I am not seeing any scrollbar. Also I am wondering if there is a option in JPanel that would resize the object inside Jpanel automatically according to the zoom level of the JPanel. Any help would be highly appreciated. public class xmlottgui { private JPanel Container; private JFrame frmCreateXml;