jpanel

Cleaning up a Nested J panel

无人久伴 提交于 2019-12-11 11:24:53
问题 Rebuilt the SCCE for you guys. My goal is this The general idea is that clicking on the title bars of the menus (right side) will collapsible (set visible to false) the content panes associated with them: gender_panel_BG collapses gender_panel_body race_panel_BG collapses race_panel_body class_panel_BG collapses class_panel_body base_stats_panel_BG collapses base_stats_panel_body merits_panel_BG collapses merits_panel_body You get the idea Another thing that is bugging me is the huge space at

How to remove the space in JMenu Items

血红的双手。 提交于 2019-12-11 11:12:32
问题 As of now, I have this And this is my source code for MyFrame1 : import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.Insets; import java.awt.Color; import java.awt.Color.*; import java.awt.Font; import java.awt.Font.*; import java.io.*; import java.io.BufferedReader; import java.io.FileReader; import javax.swing.JLabel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax

choosing the best Layout for this jframe

Deadly 提交于 2019-12-11 11:04:38
问题 plz can any one help me to choose the best Layout to make this window 回答1: I think BoxLayout is a good solution for your situation. You just provides the size of the frame and some gaps but not the components.I give it an assessment of each component. The x is 30 pixels. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import

How do I put multiple JPanels (3) in a JPanel Using JTabbedPane?

寵の児 提交于 2019-12-11 11:03:17
问题 I am trying to create a gui app using JTabbedPane to create 5 tabs connected to a database. Each tab contains a panel with 3 panels in it (one panel to hold JButtons another to hold JLabels and JTextFields and the last to hold a JTable. Each to the South, Center and North respectively). But after creating the tabs and its components, only the last tab displays and it displays incorrectly (it displays the JLabels, JTextfields and JButtons of all 5 tabs). If I remove all tabs and leave one it

Java Swing: combine effects of CardLayout and JLayeredPane

两盒软妹~` 提交于 2019-12-11 10:37:23
问题 I am trying to place some JPanel s one on top of the other, completely overlapping. I use JLayeredPane to have them in different "depth" so I can change the depth and opacity to see a certain panel "under" another. Here is a small test I did which is working properly: public class LayeredCardPanel extends JPanel { private static final String BLUE_PANEL = "blue "; private static final String RED_PANEL = "red "; private static final String GREEN_PANEL = "green"; private String[] panelNames = {

Java- How to Flash JPanel Window

余生长醉 提交于 2019-12-11 10:28:22
问题 I have a JPanel window with a few things drawn on it. I am trying to figure out how I can flash the screen, like one simple flash, to get a users attention? I found a previous question on this but it did not work for what I am trying to do. I have a continuous loop that updates the screen based on a few variables. I would just like the screen to flash at a certain point and then go back to normal. Thanks! 回答1: You can use Trident to interpolate various properties in your class. Here is a demo

Transparent Window

荒凉一梦 提交于 2019-12-11 10:25:18
问题 I have a fullscreen JFrame . I added a map to JPanel then added it to JFrame . Now I want to add a transparent window to JFrame . I want to see all map and I want to move transparent window. I did it with internal frame but I couldn't it's title tranparent. Could you help me about this? Thanks ... 回答1: One possible way is to add a JPanel to the glasspane. 回答2: Does com.sun.awt.AWTUtilities.setWi­ndowOpacity(this, 0.3f); work? (although it's not an officially supported API, natch). Regardless,

JPanel Drawing Glitch

烂漫一生 提交于 2019-12-11 09:59:59
问题 I am using a JPanel to draw my game onto, using a fixed game loop, and double buffering; however I get a glitch somewhere on the screen. The glitch is a screen tearing visual artifact that stretches across X axis, and is about 20 pixels tall. I have recreated the problem in 1 class, as shown below. To recreate the problem, you can run the code and move the square around with the arrow keys, when the square moves over the place where the visual tearing occurs, you should see the effect. (The

JPanel repaint from another class

[亡魂溺海] 提交于 2019-12-11 09:51:24
问题 I have a JPanel which displays an image. In a separate class, I'm reading from an xml file points. I am firstly creating an arraylist of triangles from these points. However I need to show the triangles on the image, i.e. draw them on! (yes this should be simple). But as these points and triangles are created in another class, I do not seem to be able to draw them on the already-displayed image within the GUI class. I have tried creating a ArrayList in the JPanel itself, which I update and

Why is my JScrollPane not working?

戏子无情 提交于 2019-12-11 09:37:49
问题 Can someone work out why my JScrollPane is not working. Perhaps something I may have missed. I realize this might be silly without any more context than what I've shown but please ask and I shall be happy to provide more. public ApplicationFrame(String title, int x, int y, int width, int height) { // Constructor for the ApplicationFrame, no implicit Construc. setTitle(title); setResizable(true); setBounds(x, y, width, height); setLayout(new BorderLayout()); setDefaultCloseOperation(DISPOSE_ON