Afficher icone fermer .. dans JInternalFrame
Résolu
astrocybernaute
Messages postés
80
Date d'inscription
Statut
Membre
Dernière intervention
-
simplygirl -
simplygirl -
Bonjour,
j'utilise une jInternalFrame pour mon appli et je veux afficher les icones fermer agrandir reduire dans la barre
jai deja fait ce code:
super( "About",
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
mais je ne vois rien, les icones ne sont pas affiché !!
pourtant quand je clique la ou ils doivent etre affiché ca fonctionne cad jarrive a fermer ou a reduire ou a agrandir quand je clique au bon endroit !!
merci de maider le vite possible
j'utilise une jInternalFrame pour mon appli et je veux afficher les icones fermer agrandir reduire dans la barre
jai deja fait ce code:
super( "About",
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
mais je ne vois rien, les icones ne sont pas affiché !!
pourtant quand je clique la ou ils doivent etre affiché ca fonctionne cad jarrive a fermer ou a reduire ou a agrandir quand je clique au bon endroit !!
merci de maider le vite possible
A voir également:
- Afficher icone fermer .. dans JInternalFrame
- Icone - Guide
- Afficher appdata - Guide
- Icone windows - Guide
- Afficher calendrier outlook dans google agenda - Guide
- Fermer compte paypal - Guide
2 réponses
vous n'avez toujours pas de piste a me donner?!!
voici mon code au cas où vous pouvez y oir qqch qui va pas:
package src;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class AboutJInternalFrame extends JInternalFrame implements ActionListener,InternalFrameListener {
//sous menu associe a cette fenetre fille
public JMenuItem sousmenu_about;
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
JFrame frame = new JFrame();
AboutJInternalFrame inst = new AboutJInternalFrame();
JDesktopPane jdp = new JDesktopPane();
jdp.add(inst);
jdp.setPreferredSize(inst.getPreferredSize());
frame.setContentPane(jdp);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
public AboutJInternalFrame() {
//super();
super( "About",
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
this.addInternalFrameListener(this);
catch(NullPointerException e)
{
System.out.println("erreur"+e.getMessage()+"\n"+e.getCause()+"\n"+e.getLocalizedMessage()+"\n"+e.getStackTrace());
}
initGUI();
}
private void initGUI() {
try {
setPreferredSize(new Dimension(400, 300));
this.setBounds(0, 0, 400, 300);
setVisible(true);
this.setTitle("About");
this.setSelected(true);
} catch (Exception e) {
e.printStackTrace();
}
}
public void internalFrameActivated(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameClosed(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameClosing(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameDeactivated(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameDeiconified(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameIconified(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameOpened(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
merci d'avance
voici mon code au cas où vous pouvez y oir qqch qui va pas:
package src;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class AboutJInternalFrame extends JInternalFrame implements ActionListener,InternalFrameListener {
//sous menu associe a cette fenetre fille
public JMenuItem sousmenu_about;
{
//Set Look & Feel
try {
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
JFrame frame = new JFrame();
AboutJInternalFrame inst = new AboutJInternalFrame();
JDesktopPane jdp = new JDesktopPane();
jdp.add(inst);
jdp.setPreferredSize(inst.getPreferredSize());
frame.setContentPane(jdp);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
public AboutJInternalFrame() {
//super();
super( "About",
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
this.addInternalFrameListener(this);
catch(NullPointerException e)
{
System.out.println("erreur"+e.getMessage()+"\n"+e.getCause()+"\n"+e.getLocalizedMessage()+"\n"+e.getStackTrace());
}
initGUI();
}
private void initGUI() {
try {
setPreferredSize(new Dimension(400, 300));
this.setBounds(0, 0, 400, 300);
setVisible(true);
this.setTitle("About");
this.setSelected(true);
} catch (Exception e) {
e.printStackTrace();
}
}
public void internalFrameActivated(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameClosed(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameClosing(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameDeactivated(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameDeiconified(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameIconified(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void internalFrameOpened(InternalFrameEvent arg0) {
// TODO Auto-generated method stub
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
merci d'avance
aucune idée à me donner.....
pour afficher l'icone fermer d'une sous fenetre JInternalFrame tu doit écrire dans ta fonction :
"this.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);"
et pour le reste il suffit de remplacer le "DISPOSE_ON_CLOSE" par le bouton que tu veux ajouter. normalement quand tu saisi le point après JInternalFrame l'application te propose plusieurs actions.
voila :)
"this.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);"
et pour le reste il suffit de remplacer le "DISPOSE_ON_CLOSE" par le bouton que tu veux ajouter. normalement quand tu saisi le point après JInternalFrame l'application te propose plusieurs actions.
voila :)