SPAM: How to implement absolute positioning (non layout manager) for JInternalFrame.
Dear my friends... Please tell me, How to implement absolute positioning (non layout manager) for JInternalFrame. Here are my work. But it does not work as I expect. The button (bsimpan) does not appear. Please tell me why.... ==== //neraca.java contents package cash; import java.io.*; import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; /** * * @author patrix */ public class neraca extends JInternalFrame implements ActionListener{ /** Creates a new instance of neraca */ public neraca() { super("Layar menu display neraca", true, true, true); setDefaultCloseOperation(JInternalFrame.EXIT_ON_CLOSE); Container kontener = new Container(); kontener.setLayout(null); JButton bsimpan = new JButton(); kontener.add(bsimpan); Insets inset = kontener.getInsets(); Dimension dimensi = bsimpan.getPreferredSize(); bsimpan.setBounds(125 + inset.left, 50 + inset.top, dimensi.width, dimensi.height); pack(); show(); } public void actionPerformed(ActionEvent event){ } } ===== //cash.java contents package cash; /** * * @author patrix */ public class cash { /** Creates a new instance of cash */ public cash() { } /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here new layar(); } } ===== /* * layar.java * * Created on September 14, 2006, 2:34 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package cash; import java.io.*; import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; /** * * @author patrix */ public class layar extends JFrame implements ActionListener { JMenuBar menuutama = new JMenuBar(); JMenu menu1 = new JMenu("Data Entry"); JMenu menu2 = new JMenu("Display Neraca"); JMenuItem mtransaksi = new JMenuItem("Transaksi"); JMenuItem mneraca = new JMenuItem("Neraca Bisnis"); Container kontener = new Container(); /** Creates a new instance of layar */ public layar(){ super("Cash - Aplikasi Administrasi dan Finansial bisnis"); setSize(800,600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setJMenuBar(menuutama); mtransaksi.addActionListener(this); mneraca.addActionListener(this); menuutama.add(menu1); menuutama.add(menu2); menu1.add(mtransaksi); menu2.add(mneraca); menuutama.setSize(800,100); menuutama.setLocation(60,60); menuutama.setVisible(true); kontener=getContentPane(); kontener.setLayout(new FlowLayout()); show(); } public void actionPerformed(ActionEvent event){ if (event.getSource()==mtransaksi){ panggillayar2(); } if (event.getSource()==mneraca){ panggilneraca(); } } private void panggillayar2(){ JDesktopPane desktop = new JDesktopPane(); desktop.putClientProperty("JDesktopPane.dragMode","outline"); layar2 panggilframe = new layar2(); desktop.add(panggilframe); setContentPane(desktop); } private void panggilneraca() { JDesktopPane desktop = new JDesktopPane(); desktop.putClientProperty("JDesktopPane.dragMode","outline"); neraca panggilneraca = new neraca(); desktop.add(panggilneraca); setContentPane(desktop); } }
Hi Patrix. You may be better off placing your question on one of the following Java specific forums: http://forum.java.sun.com/index.jspa I'm sure you will get the right replies to your questions there. Regards Keith ------------------------------------------------------------ http://www.karsites.net http://www.raised-from-the-dead.org.uk This email address is challenge-response protected with http://www.tmda.net ------------------------------------------------------------ On Sun, 15 Oct 2006, Patrix Sexy wrote:
To: suse-programming-e@suse.com From: Patrix Sexy <patrixsexy@telkom.net> Subject: [suse-programming-e] SPAM: How to implement absolute positioning (non layout manager) for JInternalFrame.
Dear my friends...
Please tell me, How to implement absolute positioning (non layout manager) for JInternalFrame.
Here are my work. But it does not work as I expect. The button (bsimpan) does not appear.
Please tell me why.... ==== //neraca.java contents
package cash;
import java.io.*; import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.event.*;
/** * * @author patrix */ public class neraca extends JInternalFrame implements ActionListener{
/** Creates a new instance of neraca */ public neraca() { super("Layar menu display neraca", true, true, true);
setDefaultCloseOperation(JInternalFrame.EXIT_ON_CLOSE); Container kontener = new Container(); kontener.setLayout(null);
JButton bsimpan = new JButton();
kontener.add(bsimpan);
Insets inset = kontener.getInsets();
Dimension dimensi = bsimpan.getPreferredSize(); bsimpan.setBounds(125 + inset.left, 50 + inset.top, dimensi.width, dimensi.height);
pack(); show(); }
public void actionPerformed(ActionEvent event){ }
}
===== //cash.java contents package cash;
/** * * @author patrix */ public class cash {
/** Creates a new instance of cash */ public cash() { }
/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here new layar(); }
}
===== /* * layar.java * * Created on September 14, 2006, 2:34 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */
package cash;
import java.io.*; import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.event.*;
/** * * @author patrix */ public class layar extends JFrame implements ActionListener { JMenuBar menuutama = new JMenuBar();
JMenu menu1 = new JMenu("Data Entry"); JMenu menu2 = new JMenu("Display Neraca");
JMenuItem mtransaksi = new JMenuItem("Transaksi"); JMenuItem mneraca = new JMenuItem("Neraca Bisnis");
Container kontener = new Container();
/** Creates a new instance of layar */ public layar(){ super("Cash - Aplikasi Administrasi dan Finansial bisnis"); setSize(800,600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setJMenuBar(menuutama);
mtransaksi.addActionListener(this); mneraca.addActionListener(this);
menuutama.add(menu1); menuutama.add(menu2); menu1.add(mtransaksi); menu2.add(mneraca);
menuutama.setSize(800,100); menuutama.setLocation(60,60); menuutama.setVisible(true);
kontener=getContentPane(); kontener.setLayout(new FlowLayout());
show(); }
public void actionPerformed(ActionEvent event){ if (event.getSource()==mtransaksi){ panggillayar2(); } if (event.getSource()==mneraca){ panggilneraca(); } }
private void panggillayar2(){ JDesktopPane desktop = new JDesktopPane(); desktop.putClientProperty("JDesktopPane.dragMode","outline"); layar2 panggilframe = new layar2(); desktop.add(panggilframe); setContentPane(desktop); }
private void panggilneraca() { JDesktopPane desktop = new JDesktopPane(); desktop.putClientProperty("JDesktopPane.dragMode","outline"); neraca panggilneraca = new neraca(); desktop.add(panggilneraca); setContentPane(desktop); }
}
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
participants (2)
-
Keith Roberts
-
Patrix Sexy