Results 1 to 2 of 2
Thread: Layered Panes
- 10-03-2009, 09:33 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 9
- Rep Power
- 0
Layered Panes
I would like to add a JDrawPanel on top of all my other JPanels/Container.
This is what I have so far, I want to add a JDrawPanel on top of all of that, and still have access to the Fields (below would work too).
Thanks in advance.
Java Code:import javax.swing.*; //JButton import java.awt.*; //Container and Layouts import java.awt.event.*; //Listeners import java.text.NumberFormat; //CurrencyFormatter public class CheckOut extends JFrame { public static void main (String[] args) { CheckOut window = new CheckOut(); window.setVisible(true); //makes the window visible window.setResizable(false); } public CheckOut() { setTitle("Beach Fee - Check Out v1.0"); //sets the title of window to Bank Teller setSize(400,250); //Sets the size of the window setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Makes it so the "X" button works setLocationRelativeTo(null);//creates GUI in center of screen JLayeredPane content = new JLayeredPane(); content.setLayout(new BorderLayout()); JPanel north = new JPanel(); north.setLayout(new GridLayout(1,3)); content.add(north, BorderLayout.NORTH); JPanel center = new JPanel(); center.setLayout(new GridLayout(2,6)); content.add(center, BorderLayout.CENTER); JPanel south = new JPanel(); south.setLayout(new GridLayout(1,3)); content.add(south, BorderLayout.SOUTH); JTextField taggerID = new JTextField ("Tagger ID"); JLabel lastName = new JLabel ("Last Name"); JLabel firstName = new JLabel ("First Name"); JLabel dailyLabel = new JLabel ("Dist. Daily:"); JLabel weeklyLabel = new JLabel ("Weekly:"); JLabel seasonalLabel = new JLabel ("Seasonal:"); JLabel daily = new JLabel ("0", JLabel.CENTER); JLabel weekly = new JLabel("0", JLabel.CENTER); JLabel seasonal = new JLabel("0", JLabel.CENTER); JLabel ldsold = new JLabel("Sold Daily"); JLabel lwsold = new JLabel("Weekly"); JLabel lssold = new JLabel("Seasonal"); JTextField dsold = new JTextField("50", JLabel.CENTER); JTextField wsold = new JTextField("25", JLabel.CENTER); JTextField ssold = new JTextField("0", JLabel.CENTER); JLabel lret = new JLabel("Returned $"); JTextField ret = new JTextField("Amount calculated"); JLabel off = new JLabel("+/-"); lastName.setForeground(Color.white); firstName.setForeground(Color.white); dailyLabel.setForeground(Color.white); weeklyLabel.setForeground(Color.white); seasonalLabel.setForeground(Color.white); ldsold.setForeground(Color.white); lwsold.setForeground(Color.white); lssold.setForeground(Color.white); lret.setForeground(Color.white); off.setForeground(Color.white); daily.setForeground(Color.white); weekly.setForeground(Color.white); seasonal.setForeground(Color.white); north.add(taggerID); north.add(lastName); north.add(firstName); center.add(dailyLabel); center.add(daily); center.add(weeklyLabel); center.add(weekly); center.add(seasonalLabel); center.add(seasonal); center.add(ldsold); center.add(dsold); center.add(lwsold); center.add(wsold); center.add(lssold); center.add(ssold); south.add(lret); south.add(ret); south.add(off); content.setBackground(Color.blue); south.setBackground(Color.blue); center.setBackground(Color.blue); north.setBackground(Color.blue); } }
-
Since it is not part of standard Java, I have to ask: What exactly is a JDrawPanel? Also, you may wish to create and post a paragraph describing in greater detail what you're trying to do.
edit: Also, I don't see where you're adding anything to the JFrame or its contentPane, so nothing will be visible. Also, I think that JLayeredPanes typically use no layout managers (null), but I could be wrong on this point.Last edited by Fubarable; 10-03-2009 at 11:23 PM.
Similar Threads
-
panes, frames and ddm's :|
By skatefreak in forum New To JavaReplies: 1Last Post: 08-09-2009, 10:21 AM -
transparent gifs and layered panels
By infinity in forum AWT / SwingReplies: 0Last Post: 05-01-2009, 08:52 PM -
GUI Help(Layered panes, opacity, events)
By xcallmejudasx in forum New To JavaReplies: 1Last Post: 04-29-2009, 11:11 PM -
Layered Pane Demo
By Java Tip in forum javax.swingReplies: 0Last Post: 06-26-2008, 07:44 PM -
Two content panes in one GUI?
By Leprechaun in forum New To JavaReplies: 1Last Post: 01-31-2008, 04:02 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks