• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can i display minimize and iconifiable button in JInternalFrame

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

My code is as follows:

package practise;


public class ItemForm extends javax.swing.JInternalFrame {

/** Creates new form ItemForm */
public ItemForm() {
super("Item Form",true, true, true, true);
initComponents();
}


private void initComponents() {

setClosable(true);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
setTitle("Item Form");
setMaximumSize(new java.awt.Dimension(800, 600));

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 394, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 278, Short.MAX_VALUE)
);

pack();
}

But Minimize and iconifiable buttons are not displaying on the JIntenalFrame.

Neither I am able to resize the window. Please help.....

Thanks
Brijesh
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> But Minimize and iconifiable buttons are not displaying on the JIntenalFrame.
> Neither I am able to resize the window. Please help.....

worked fine for me.

perhaps posting a full working (non-working?) program might help resolve your problem
 
Brijesh Sah
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
see the attached image

in Item form no minimize and iconifiable button only close button
form2.JPG
[Thumbnail for form2.JPG]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> see the attached image

means zip, without the code.
 
Brijesh Sah
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Code As Follows:

MainForm.java // It will display the main form with menu

package practise;


public class MainForm extends javax.swing.JFrame {

/** Creates new form MainForm */
public MainForm() {
initComponents();
}


private void initComponents() {

jContainer = new javax.swing.JDesktopPane();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
mnuCustomer = new javax.swing.JMenuItem();
mnuItem = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jMenu1.setText("Forms");

mnuCustomer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK));
mnuCustomer.setText("Customer");
mnuCustomer.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuCustomerActionPerformed(evt);
}
});
jMenu1.add(mnuCustomer);

mnuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
mnuItem.setText("Item");
mnuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuItemActionPerformed(evt);
}
});
jMenu1.add(mnuItem);

jMenuBar1.add(jMenu1);

jMenu2.setText("File");

jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK));
jMenuItem3.setText("Exit");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem3);

jMenuBar1.add(jMenu2);

setJMenuBar(jMenuBar1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jContainer, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jContainer, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE)
.addContainerGap())
);

pack();
}

private void mnuCustomerActionPerformed(java.awt.event.ActionEvent evt) {
CustomerView cv=new CustomerView();
jContainer.add(cv);
cv.setVisible(true);
}

private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}

private void mnuItemActionPerformed(java.awt.event.ActionEvent evt) {
ItemForm iv=new ItemForm();
jContainer.add(iv);
iv.setVisible(true);
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainForm().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JDesktopPane jContainer;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem mnuCustomer;
private javax.swing.JMenuItem mnuItem;
// End of variables declaration

}


then ItemForm.java // code pasted on first part
but i am not getting the buttons
is it clear or i will paste here only

 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Use Code Tags. You can edit your post to add them.
 
Brijesh Sah
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am editing my question. Please go through my problem and give me a solution.

MainForm.java // This class will display the main window and it will act as MDI form






I am not getting the minimize or iconifiable button on the screen. Neither I am able to resize the window. Please help.

If you can give any other way to do the make MDI form in java. Then also i am fine with that.
Thanks

Brijesh
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still hadn't used code tags. I've added them for you this once, and you can see how much better it looks.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
again, worked fine for me - clicking Forms/Item, JInternalFrame appeared, with all buttons (working).

perhaps an OS or version problem - I'm using java 1.6.0_15 on Vista Home Premium

in the code you posted there's no advantage in extending JInternalFrame (you may be adding code later),
so see if it makes any difference using a standard JInternalFrame

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic