jpanel

JPanel transparent background and display elements [duplicate]

社会主义新天地 提交于 2020-07-16 04:28:12
问题 This question already has an answer here : Error loading background image into JPanel in a JFrame (1 answer) Closed last month . I insert a background imag e into a JPanel but some interface elements disappear. The following Java Swing elements do not appear: label_titulo label_usuario label_password button_acceder **Can you make the image transparent or that the elements are not opaque (setOpaque (false)), even putting it to those elements does not work for me. Why do some elements have

JPanel transparent background and display elements [duplicate]

左心房为你撑大大i 提交于 2020-07-16 04:27:25
问题 This question already has an answer here : Error loading background image into JPanel in a JFrame (1 answer) Closed last month . I insert a background imag e into a JPanel but some interface elements disappear. The following Java Swing elements do not appear: label_titulo label_usuario label_password button_acceder **Can you make the image transparent or that the elements are not opaque (setOpaque (false)), even putting it to those elements does not work for me. Why do some elements have

Why after I added components to JFrame instead of adding them to JPanel all these components were gone?

穿精又带淫゛_ 提交于 2020-06-17 10:26:06
问题 When I added JComboBox, JRadioButton, JButton to JPanel, it was working fine, but after I added them to JFrame instead and executed it, all these components were gone. My code is listed below: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Test21 { public static void main(String[] args) { JFrame jf = new JFrame("康樂彩歌(v0)"); jf.setBounds(0, 0, 1368, 730); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label1 = new JLabel("選歌:"); //創建標簽 label1.setFont

JPanel transparent background and display elements [duplicate]

ぃ、小莉子 提交于 2020-06-09 07:05:34
问题 This question already has an answer here : Error loading background image into JPanel in a JFrame (1 answer) Closed 21 days ago . I insert a background imag e into a JPanel but some interface elements disappear. The following Java Swing elements do not appear: label_titulo label_usuario label_password button_acceder **Can you make the image transparent or that the elements are not opaque (setOpaque (false)), even putting it to those elements does not work for me. Why do some elements have

JPanel transparent background and display elements [duplicate]

こ雲淡風輕ζ 提交于 2020-06-09 07:05:30
问题 This question already has an answer here : Error loading background image into JPanel in a JFrame (1 answer) Closed 21 days ago . I insert a background imag e into a JPanel but some interface elements disappear. The following Java Swing elements do not appear: label_titulo label_usuario label_password button_acceder **Can you make the image transparent or that the elements are not opaque (setOpaque (false)), even putting it to those elements does not work for me. Why do some elements have

Error loading background image into JPanel in a JFrame

青春壹個敷衍的年華 提交于 2020-06-09 03:27:31
问题 I have a JFrame in which I want to occupy it entirely with a JPanel and put a background image in the JPanel . Code: public class InicioSesion extends javax.swing.JFrame{ private Image imagenFondo; private URL fondo; public InicioSesion(){ initComponents(); try{ fondo = this.getClass().getResource("fondo.jpg"); imagenFondo = ImageIO.read(fondo); }catch(IOException ex){ ex.printStackTrace(); System.out.print("Image dont load"); //Dont load the message. } Container c = getContentPane(); c.add

Error loading background image into JPanel in a JFrame

亡梦爱人 提交于 2020-06-09 03:26:07
问题 I have a JFrame in which I want to occupy it entirely with a JPanel and put a background image in the JPanel . Code: public class InicioSesion extends javax.swing.JFrame{ private Image imagenFondo; private URL fondo; public InicioSesion(){ initComponents(); try{ fondo = this.getClass().getResource("fondo.jpg"); imagenFondo = ImageIO.read(fondo); }catch(IOException ex){ ex.printStackTrace(); System.out.print("Image dont load"); //Dont load the message. } Container c = getContentPane(); c.add

How to move undecorated JFrame by holding click on a JPanel in Java? [duplicate]

瘦欲@ 提交于 2020-04-15 04:33:12
问题 This question already has answers here : Drag and Resize undecorated JFrame (2 answers) Closed 5 years ago . I've been making an undecorated JFrame so far and I was wondering if it's possible to move the undecorated JFrame by holding click on a JPanel. Here is the source code I'm working on. private static void createFrame() { JFrame frame = new JFrame("Text Frame"); frame.setLayout(null); frame.setSize(500,300); frame.setUndecorated(true); JPanel panel = new JPanel(); panel.setBounds(0, 2,

Trying to draw lines based on doubles but nothing shows?

落爺英雄遲暮 提交于 2020-03-06 02:38:10
问题 Here's the class in which I try to draw the lines package gps; import java.awt.*; import java.awt.geom.Line2D; import java.util.*; import javax.swing.*; public class RoadMap extends JPanel { public void paintComponent(Graphics2D g) { super.paintComponent(g); g.setColor(Color.blue); for(int i = 0; i < Graph.getEdges().length; i++) { Shape s = new Line2D.Double(Graph.vMap.get(Graph.getEdges()[i].i1).x, Graph.vMap.get(Graph.getEdges()[i].i1).y, Graph.vMap.get(Graph.getEdges()[i].i2).x, Graph

Java: How can I modify the size of a JPanel in runtime?

别来无恙 提交于 2020-03-05 09:29:12
问题 I want to modify the size of the JPanel while the program is running, for example with a menu item. How can I reach it? Or how should I modify my program to get acces to the live JPanel in the content pane? Edit: If I make a contentpane for a gamefield that's 400x400 in the start as default. But what if I want to ad an option in the menu to change the size to 500x500, but without losing all of the content already in progress by the player. JFrame class: package me.test; import javax.swing