All pastes #631533 Raw Edit

Stuff

public java v1 · immutable
#631533 ·published 2007-07-24 01:53 UTC
rendered paste body
/* * Module_DragAndHear.java * * Created on July 21, 2007, 12:13 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package my.Nikamo.pkg;import java.awt.*;import java.awt.event.*;import javax.swing.*; public class Main extends JFrame{	JLayeredPane layeredPane;	Component dragComponent;	int xAdjustment;	int yAdjustment; 	public Main()	{                JLabel jl = new JLabel("Hello");                            		layeredPane = new JLayeredPane();		layeredPane.setLayout( null );                //layeredPane.setPreferredSize(new Dimension(300,300));                //layeredPane.setMaximumSize(new Dimension(400,400));                layeredPane.setBorder(BorderFactory.createLineBorder(Color.GREEN));                layeredPane.setBounds(50,50,600,500);                                 //********************************************************************************//                // If these two lines are like this, then it doesn't work, when the jframe is maximized                // the bounds still do not show set. However, when I reverse the bottom two lines, then it works perfectly.                //*********************************************************************************//                //Even if I leave out the this.add(jl); completely (so that the layeredPane is the only component,                 //the bounds still do not show up, until any component is added AFTER the layeredPane.                //*********************************************************************************                                this.add(jl);                            	this.add(layeredPane);                	}         	public static void main(String[] args)	{		JFrame frame = new Main();		frame.setDefaultCloseOperation( DISPOSE_ON_CLOSE );		frame.setSize(600, 600);		frame.setLocationRelativeTo( null );		frame.setVisible(true);	 }}