jframe

Set JFrame background transparent but show contents

狂风中的少年 提交于 2019-12-13 22:17:49
问题 I'm looking for some solution to turn an opaque, null JFrame background to transparent (no Translucent) but showing swing components like buttons containers etc... here a example. Default JFrame Something like, HERE disable the background 回答1: This is a simple two step process... First, you need to make a transparent frame... JFrame frame = new JFrame("Testing"); frame.setUndecorated(true); frame.setBackground(new Color(0, 0, 0, 0)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame

How to set a JPanel over a JFrame?

白昼怎懂夜的黑 提交于 2019-12-13 22:09:05
问题 I have a class named BoardGUI extended from JFrame , in a constructor I have made a JPanel with two buttons in it. I have added this panel into my frame. Whenever I run this program, buttons get invisible. As I bring my mouse cursor over the buttons they get visible. Code is as follows: public class BoardGUI extends JFrame { Play pieces; JButton a=new JButton("Undo"); JButton r=new JButton("replay"); JPanel jp=new JPanel(); public BoardGUI() { pieces = new Play(); setTitle("Checkers Game");

Absolute Positioning a JButton

為{幸葍}努か 提交于 2019-12-13 21:54:49
问题 I am trying to position a JButton with a null layout but it will not show up, if i switch to gridlayout they are only lined up in the middle no matter what i change. How can i set the position and size of my button? In Frame package Run; import javax.swing.*; import ThreeD.Display; import ThreeD.Launcher; import TowerDefence.Window; import java.awt.*; import java.awt.image.BufferedImage; public class Frame extends JFrame{ public static String title = "Game"; /*public static int

My JFrame is not showing output of the dial

故事扮演 提交于 2019-12-13 21:24:36
问题 This is my DialPlot class: public class Demo { private DefaultValueDataset dataset = new DefaultValueDataset(0); private ChartPanel buildDialPlot(int minimumValue=0,int maximumValue,int majorTickGap) { DialPlot plot = new DialPlot(dataset); plot.setDialFrame(new StandardDialFrame()); plot.addLayer(new DialValueIndicator(0)); plot.addLayer(new DialPointer.Pointer()); int redLine =maximumValue / 5 + 10; plot.addLayer(new StandardDialRange(maximumValue, redLine, Color.blue)); plot.addLayer(new

java Access parent method from imported child class

雨燕双飞 提交于 2019-12-13 20:06:18
问题 Am a java newbie. Learning from the web. I am stuck with an issue with my code. I have three class. mainclass.java, oneclass.java, twoclass.java. I imported oneclass and twoclass in mainclass. oneclass has a "next" button. What i want to do is onActionEvent on next btn , call a function from mainclass, which would set the visibility of oneclass to false and twoclass to true. Am posting the whole code for mainclass.java package com.mainclass; import com.twoframe.twojframes; import com

Swing Parent JFrame/JPanel unusable/clickable while child panel is loaded

荒凉一梦 提交于 2019-12-13 19:17:45
问题 I am loading a JFrame AdminFrame (with add user and addLocation button on it) when the user click's addUser button the new JFrame addUser loads and takes user information. When the information is submitted to server it takes some time(because server is web-based) during that time both of my panels got stuck...what i want is to make AdminFrame clickable and use-able so that user can add new user or can add location... Here is my AdminPanel s add button's template code...not writing original

BufferedImage in JFrame doesnt Show up

烂漫一生 提交于 2019-12-13 18:43:42
问题 trying to get an image to print into a window. Everything runs without errors, and it also works if I replace the drawImage with another graphics class. However, the window is missing the image, and i'm not sure why. Again, the JFrame stuff and Graphics work fine with drawing other graphics, but only doesn't draw the image here. Thanks. import javax.swing.JApplet; import javax.swing.JFrame; import javax.imageio.*; import javax.imageio.stream.*; import java.awt.*; import java.awt.image.*;

JLayeredPane not drawing

僤鯓⒐⒋嵵緔 提交于 2019-12-13 18:14:41
问题 Good day, Hopefully this is a quick kill question. I am writing an application that uses JPanels and JLayeredPane inside a JFrame. On the initial start of my application, one of the panels does not show up until my mouse moves over the area where the panel should be. I even call the validate and repaint methods, but I am still able to display both panels together. Any suggestions? Thank you. Here is my JFrame class (which has the main method) import java.awt.Dimension; import javax.swing

java setFullScreenWindow hides log in dialog in Mac

橙三吉。 提交于 2019-12-13 16:40:01
问题 I was using a full screen window to something similar to screensaver. Using the method here, GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .setFullScreenWindow(this); But when the screen is locked, or the screensaver runs, and this screen is shown, this screen is shown on top. I can't get access to the login prompt. So the java frame is on top and I can do nothing. I have to restart the computer to get rid of this. Since when the login screen comes, no other

JFrame and JPanel problems

北城余情 提交于 2019-12-13 15:45:53
问题 I am attempting to make a program for a local bagel shop that sells pastries, bagels, and coffee. I am having trouble implementing the panels that I have made into the JFrame any help understanding how to make my JFrame look like this would be helpful http://kepler.covenant.edu/COS150/Bagel_files/image002.jpg Once I have this working I hope to have the middle set of panels change depending on which product is selected. I am not entirely sure how to make the buttons and panels talk to one