JInternal Frames

Hi all, I am currently writing a program which should allow me to add, delete, search and edit database records. What i would like to do is to click one of the six buttons on the toolbar and it to lauch a form within an internal frame. I have had a go but a cannot make the frame viewable. If you could help me i would be very grateful. Cheers x
package worldfactfile;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
public class mainScreen extends JFrame implements ActionListener{
  JPanel contentPane, panel;
  private JDesktopPane theDesktop;
  private JButton button1, button2, button3, button4, button5, button6;
  BorderLayout borderLayout1 = new BorderLayout();
  XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  //Construct the frame
  public mainScreen() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    catch(Exception e) {
      e.printStackTrace();
  //Component initialization
  private void jbInit() throws Exception {
    ImageIcon image1 = new ImageIcon("add.gif");
    ImageIcon image2 = new ImageIcon("edit.gif");
    ImageIcon image3 = new ImageIcon("delete.gif");
    ImageIcon image4 = new ImageIcon("search.gif");
    ImageIcon image5 = new ImageIcon("help.gif");
    ImageIcon image6 = new ImageIcon("exit.gif");
    button1 = new JButton(image1);
    button2 = new JButton(image2);
    button3 = new JButton(image3);
    button4 = new JButton(image4);
    button5 = new JButton(image5);
    button6 = new JButton(image6);
    button1.addActionListener(this);
    button6.addActionListener(this);
    JToolBar bar = new JToolBar();
    bar.add(button1);
    bar.add(button2);
    bar.add(button3);
    bar.add(button4);
    bar.add(button5);
    bar.add(button6);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);
    theDesktop = new JDesktopPane();
    contentPane.add("Center", theDesktop);
    contentPane.add("South", bar);
    this.getContentPane().setBackground(SystemColor.controlText);
    this.setSize(new Dimension(950, 750));
    this.setTitle("World Fact File");
    panel = new JPanel() {
                 public void paintComponent(Graphics g)     {
                         ImageIcon img = new ImageIcon("globe2.gif");
                         g.drawImage(img.getImage(), -20, -50, null);
                         super.paintComponent(g);
         panel.setOpaque(false);
    contentPane.add(panel);
  public void actionPerformed(ActionEvent e){
    if(e.getSource() == button6){
      System.exit(0);
    if(e.getSource() == button1){
      JInternalFrame iFrame = new JInternalFrame("My Frame, mine i said", true, true, true, true);
      JLabel lb1 = new JLabel("Hey ho...");
      iFrame.getContentPane().add(lb1);
      iFrame.setSize(new Dimension(200,50));
      iFrame.setVisible(true);
      theDesktop.add(iFrame);
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
}

here is ur code, i've modifyed some places. its working now.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class mainScreen extends JFrame implements ActionListener{
  JPanel contentPane, panel;
  JDesktopPane theDesktop;
  JButton button1, button2, button3, button4, button5, button6;
  BorderLayout borderLayout1 = new BorderLayout();
  //XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  //Construct the frame
  public mainScreen() {
    button1 = new JButton("One");
    button2 = new JButton("Two");
    button3 = new JButton("Three");
    button4 = new JButton("Four");
    button5 = new JButton("Five");
    button6 = new JButton("Six");
    button1.addActionListener(this);
    button6.addActionListener(this);
    JToolBar bar = new JToolBar();
    bar.add(button1);
    bar.add(button2);
    bar.add(button3);
    bar.add(button4);
    bar.add(button5);
    bar.add(button6);
    //contentPane = (JPanel) this.getContentPane();
    panel = new JPanel();
    panel.setLayout(borderLayout1);
    theDesktop = new JDesktopPane();
    panel.add("Center", theDesktop);
    panel.add("South", bar);
    getContentPane().add(panel);
    setSize(new Dimension(950, 750));
    setTitle("World Fact File");
    setVisible(true);
  public void actionPerformed(ActionEvent e){
    if(e.getSource() == button6){
      System.exit(0);
    if(e.getSource() == button1){
      JInternalFrame iFrame = new JInternalFrame("My Frame, mine i said", true, true, true, true);
      JLabel lb1 = new JLabel("Hey ho...");
      iFrame.getContentPane().add(lb1);
      iFrame.setSize(new Dimension(200,50));
      iFrame.setVisible(true);
      theDesktop.add(iFrame);
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
  public static void main(String a[]){
       mainScreen ms = new mainScreen();
}

Similar Messages

  • Saving contents of jinternal frame

    Hi, I seem to have a problem saving files from jinternal frames. I created two files, the main GUI which holds the jdesktop pane and the other file (Documento) extends jinternalframe. I want to be able to save the current (active) jinternal frame but I have no idea how to do it. can anyone help me?
    import javax.swing.JInternalFrame;
    import javax.swing.JDesktopPane;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JMenuBar;
    import javax.swing.JFrame;
    import javax.swing.KeyStroke;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.Graphics.*;
    import javax.swing.JOptionPane;
    import java.io.*;
    import java.util.*;
    *This is the main GUI of the program.
    public class mainGUI extends JFrame
                                   implements ActionListener,
                                    KeyListener{
        JDesktopPane desktop;
        Documento frame;
         private Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
         private JPanel toolbar, editarea, resultarea, blankPanel;
         private JMenu file, edit, project;
         private JMenuItem f_open, f_new, f_save, f_saveas, f_exit, e_select, e_copy, e_paste, p_compile;
         private JTextArea resultfield, editfield,editArea, tstr;
         private JButton bcompile;
         private JFileChooser fc = new JFileChooser();
         private String filepath;
         private ImageIcon bugicon;
         private static int docNum = 0;
         private boolean b_openfile;
         File filename;
        public mainGUI() {
            super("DGJ Program Scanner");
            setSize(800,600);
              setLocation((screen.width-800)/2, (screen.height-600)/2);
            /*Creates the workspace*/
            desktop = new JDesktopPane();
            setContentPane(desktop);
            setJMenuBar(createMenuBar());
            /*Make dragging a little faster*/
            desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
          *This function creates the menu bar
        protected JMenuBar createMenuBar() {
             /*Initializes/instantiates the menu bar and its items*/
              file = new JMenu("File");
              edit = new JMenu("Edit");
              project = new JMenu("Project");
              f_new = new JMenuItem("Create new file");
              f_open = new JMenuItem("Open file...");
              f_save = new JMenuItem("Save current file");
              f_saveas = new JMenuItem("Save As...");
              f_exit = new JMenuItem("Exit program");
              e_select = new JMenuItem("Select All");
              e_copy = new JMenuItem("Copy selected");
              e_paste = new JMenuItem("Paste selected");
              p_compile = new JMenuItem("Scan current file for errors");
              /*Adds listeners to the menu items*/
              f_open.setActionCommand("f_open");
              f_open.addActionListener(this);
              f_save.setActionCommand("f_save");
              f_save.addActionListener(this);
              f_saveas.addActionListener(this);
              f_saveas.setActionCommand("f_saveas");
              f_new.setActionCommand("f_new");
              f_new.addActionListener(this);
              f_exit.setActionCommand("f_exit");
              f_exit.addActionListener(this);
              e_select.setActionCommand("e_select");
              e_select.addActionListener(this);
              e_paste.setActionCommand("e_paste");
              e_paste.addActionListener(this);     
              e_copy.setActionCommand("e_copy");
              e_copy.addActionListener(this);               
              /*Creates the icon of the bug*/
              bugicon = new ImageIcon("images/ladybug.gif");
              /*Creates the menu bar*/
              JMenuBar menu = new JMenuBar();
              menu.add(file);
                   file.add(f_new);
                   file.add(f_open);
                   file.add(f_save);
                   file.add(f_saveas);
                   file.add(f_exit);
              menu.add(edit);
                   edit.add(e_select);
                   edit.add(e_copy);
                   edit.add(e_paste);
              menu.add(project);
                   project.add(p_compile);
              /*Disables the save current file menu...(when program starts, no file is open yet)*/
              f_save.setEnabled(false);
              f_saveas.setEnabled(false);
            return menu;
        //React to menu selections.
        public void actionPerformed(ActionEvent e) {
            if ("f_new".equals(e.getActionCommand()))
            { //new
                createFrame(null);
                f_saveas.setEnabled(true);
            else if("f_open".equals(e.getActionCommand()))
            {//open documento
                   fc.setFileFilter(new SpanFilter());
                  int retval = fc.showOpenDialog(mainGUI.this);
                   tstr = new JTextArea();
                   /*This checks if the user has chosen a file*/
                if (retval == JFileChooser.APPROVE_OPTION) {
                    filename = fc.getSelectedFile();
                        filepath = filename.getPath();            
                        openFile(filename, new Point(30,30));       
            else if("f_save".equals(e.getActionCommand()))
                 try {
                      BufferedWriter out = new BufferedWriter(new FileWriter(filepath));
                      String str;
                      str = editArea.getText();
                      editArea.setText("");  
                      int length = str.length();
                      out.write(str, 0, length);
                      out.close();
                       } catch (Exception ex) {}
                       JInternalFrame fr = new JInternalFrame();
                       fr = desktop.getSelectedFrame();
                       Point p = fr.getLocation();
                        fr.dispose();    
                       openFile(filename, p);
            else if("f_saveas".equals(e.getActionCommand()))
                 fc.setFileFilter(new SpanFilter());
                  int retval = fc.showSaveDialog(mainGUI.this);
                if (retval == JFileChooser.APPROVE_OPTION) {
                    filename = fc.getSelectedFile();
                        filepath = filename.getPath();
                        if(!(filepath.contains(".dgj")))
                             filepath+=".dgj";
                      try {
                           BufferedWriter out = new BufferedWriter(new FileWriter(filepath));
                                String str;
                           str = editArea.getText();
                           int length = str.length();
                           out.write(str, 0, length);
                           out.close();
                       } catch (Exception ex) {}
                       Point p = frame.getLocation();
                        frame.dispose();
                   //     editArea.setText("");     
                       openFile(filename, p);
            else if("e_select".equals(e.getActionCommand()))
                 editArea.selectAll();
            else if("e_copy".equals(e.getActionCommand()))
                   editArea.copy();
            else if("e_paste".equals(e.getActionCommand()))
                 editArea.paste();
            else if("f_exit".equals(e.getActionCommand()))
            { //quit
                quit();
        public void openFile(File filename, Point p)
                        /*Reads the file*/
                        try {
                           BufferedReader in = new BufferedReader(new FileReader(filepath));
                             String str;
                             /*empties the textarea*/
                             tstr.setText("");
                             str = in.readLine();
                             /*Copy each line of the file into the temporary textarea*/
                           do{  
                          tstr.append(str);
                          str = in.readLine();
                          /* the "\n" is for the line to appear in the next line in the textarea,
                           * the "\r" is for windows system, wherein "\r" is required for the text
                           * to appear in beginning of the first line*/
                          if(str!=null)
                               tstr.append("\r\n");
                           }while (str != null);
                             /*Opens the new frame*/
                           createFrame(filename, filename.getName(), tstr.getText(), p);
                           in.close();
                       } catch (Exception ex){}
                      b_openfile = true;
                      f_save.setEnabled(true); 
                      f_saveas.setEnabled(true);   
         *Create a new internal frame.
        protected void createFrame(File f) {
             frame = new Documento(f);
         /*     frame = new JInternalFrame("Document "+(++docNum),
                  true, //resizable
                  true, //closable
                  true, //maximizable
                  true);
            docNum++;
              frame.setSize(600,400);
              frame.setLocation(20*(docNum%10), 20*(docNum%10));       
             editArea = new JTextArea();
              JScrollPane scroll = new JScrollPane(editArea);     
              editArea.addKeyListener(this);
              editArea.append("");
              frame.add(scroll);
            frame.setVisible(true); //necessary as of 1.3
            desktop.add(frame);
            try {
                frame.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {}
          *Overwrite an existing internal frame for an open file
        protected void createFrame(File f, String title, String text, Point P) {
             frame = new Documento(title, f, P);
              frame.setSize(600,400);
              frame.setLocation(P); 
             editArea = new JTextArea();
              JScrollPane scroll = new JScrollPane(editArea);     
              editArea.setText("");
              editArea.addKeyListener(this);
              editArea.append(text);
              frame.add(scroll);
            frame.setVisible(true); //necessary as of 1.3
            desktop.add(frame);
            try {
                frame.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {}
        //Quit the application.
        protected void quit() {
            System.exit(0);
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Make sure we have nice window decorations.
            //JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            mainGUI frame = new mainGUI();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Display the window.
            frame.setVisible(true);
        public void keyTyped(KeyEvent k){}
        public void keyPressed(KeyEvent k)
             if(k.getKeyCode()==10)
                  editArea.append("\r");           
        public void keyReleased(KeyEvent k){}
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }here's the one that extends jinternalframe
    import javax.swing.JInternalFrame;
    import javax.swing.plaf.InternalFrameUI;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.util.*;
    /* Used by mainGUI.java */
    public class Documento extends JInternalFrame {
        static final int xOffset = 30, yOffset = 30;
         static JTextArea editArea;
         static int docNum = 0;
         static File file;
          *The constructer for a new documento
        public Documento(File file) {
            super("Document "+(++docNum),
                  true, //resizable
                  true, //closable
                  true, //maximizable
                  true);//iconifiable
            docNum++;
              this.file = file;
              setSize(600,400);
              setLocation(xOffset*(docNum%10), yOffset*(docNum%10));
    //        setUI(new InternalFrameUI());
         *The constructor for an existing documento
        public Documento(String title, File file, Point p) {
            super(title,
                  true, //resizable
                  true, //closable
                  true, //maximizable
                  true);//iconifiable
              this.file = file;             
              setSize(600,400);          
              setLocation(p);
    //        setUI(new InternalFrameUI());
        public int getNum()
             return docNum;
        public File getPath()
             return file;
    }I know it's pretty lengthy...it's probably all messed up since I'm lost :p
    Thanks if you could help me!

    I would be glad to help, but first I need a clarification. If I understand properly, you have two Java classes that you have created: the "main GUI" (which is most likely a JFrame extension in which the constructor adds a JDesktopPane to the content pane) and "Documento" (which you say is a JInternalFrame extension).
    My question is this: what do you mean by "save the current JInternalFrame"? Do you want to record its position, location, and identity? Do you want to save its contents?
    Thanks. Good luck. ;)

  • How to execute windows application in Jinternal frame

    I want to execute windows application in a JInternal Frame ?

    Attach an EventListener and
    try{ Runtime.getRuntime().exec("C:\\Program Files\\Outlook Express\\ ..."); }
              catch(Exception e){}

  • JInternal frames.. please help

    Hi All,
    Can anyone tell me how to set JInternal frames as unmovable?
    I want to add it to a content pane and not alow the users to move it around,..
    Thanks

    hi,
    if i had to do the same i'd have followed the below coding.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.MouseEvent;
    public class Test extends JInternalFrame {
       // location variables to set the initial
       // location of the internalframe
       private int x;
       private int y;
       public Test(int x, int y)
          super("Sample", true, true, true, true);
          this.x = x;
          this.y = y;
          setLocation(Integer.MIN_VALUE, Integer.MAX_VALUE);
       public Test(Point loc)
          this(loc.x, loc.y);
       public Test()
          this(0, 0);
       /* Overriden method.
        * If this does'nt work then comment this method & uncomment
        * processMouseMotionEvent(MouseEvent) method.
       public void setLocation(int x, int y)
          super.setLocation(this.x, this.y);
       /* Overriden method.
        * If this does'nt work then comment this method & uncomment
        * processMouseMotionEvent(MouseEvent) method.
       public void setLocation(Point p)
          super.setLocation(this.x, this.y);
       public static void main(String args[])
          Test test = new Test();
          test.setSize(300, 300);
          JFrame frame = new JFrame("ATest");
          JDesktopPane pane = new JDesktopPane();
          frame.setContentPane(pane);
          pane.add(test);
          frame.pack();
          frame.show();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       /* Overriden method.
        * If the above setLocation methods does'nt stand to your
        * expectations, then you may try with the following method.
        * Note: You may risk the mouse dragging feature if you are
        *       implementing mouse dragging feature in the internal frame.
    /*   protected void processMouseMotionEvent(MouseEvent e)
          if(e.getID() == MouseEvent.MOUSE_DRAGGED)
             e.consume();
          } else
             super.processMouseMotionEvent(e);
    }though i've'nt tested the code, it should work smoothly. there might be more easier way to achieve what you want.
    hope this helps you,
    regards,
    Afroze.

  • How to add scrollbar to the JInternal Frame

    How to add scrollbar to JInternal Frame?
    I have One JInternal frame i want it should have a scrollbar when we reduces its size.

    [url http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html]How to Use Scroll Panes

  • How to add a jpanel in a jtable in a Jinternal frame

    hi to all,
    I want to add a panel above the table,which has been created in an internal frame,in the internal frame.
    i have created the table within the internal frame but unable to add panel in it..
    thanks

    Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Layout Managers. Mix and match layout managers to get the desired effect.

  • Background picture n problem on display other JInternal frame

    beginer;
    this is my code below n i compile it n the picture display correctly, but it seems to hide other internal frame as well, what wrong with my code :(, the problem is been specified between ? symbols
    public class InternalFrameDemo extends JFrame implements ActionListener {
    JDesktopPane desktop;
    public InternalFrameDemo() {
    super("InternalFrameDemo");
    int inset = 50;
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(inset, inset,
    screenSize.width - inset*2,
    screenSize.height - inset*2);
    Toolkit kit = Toolkit.getDefaultToolkit();
    Image icon = kit.getImage("ADD.gif");
    setIconImage(icon);
    //Set up the GUI.
    desktop = new JDesktopPane(); //a specialized layered pane
    createFrame(); //create first "window"
    setContentPane(desktop);
    setJMenuBar(createMenuBar());
    //Make dragging a little faster but perhaps uglier.
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    ImageIcon image = new ImageIcon("abc.jpg");
    JLabel background = new JLabel(image);
    background.setBounds(0, 0, image.getIconWidth(), image.getIconHeight());
    getLayeredPane().add(background, new Integer(Integer.MIN_VALUE) );
    JPanel panel = new JPanel();
    panel.setOpaque(false);
    setContentPane( panel );
    protected JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    //Set up the menu item
    return menuBar;
    public void actionPerformed(ActionEvent e) {
    else {
    quit();
    protected void createFrame() {
    Books frame = new Books();
    frame.setVisible(true);
    desktop.add(frame);
    try {
    frame.setSelected(true);
    catch (java.beans.PropertyVetoException e) {}
    protected void quit() {
    System.exit(0);
    public static void main(String[] args) {
    try {
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    catch (Exception e) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    InternalFrameDemo frame = new InternalFrameDemo();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Display the window.
    frame.setVisible(true);
    tanz.

    This might be what you are trying to do:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.plaf.*;
    public class TestInternalFrame extends JFrame
         ImageIcon icon;
         public TestInternalFrame()
              icon = new ImageIcon("????.jpg");
              JDesktopPane desktop = new JDesktopPane()
                 public void paintComponent(Graphics g)
                      Dimension d = getSize();
                      g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);
              getContentPane().add( desktop );
              final JInternalFrame internal =
                   new JInternalFrame( "Internal Frame", true, true, true, true );
              desktop.add( internal );
              internal.setLocation( 50, 50 );
              internal.setSize( 300, 300 );
              internal.setVisible( true );
         public static void main(String args[])
              TestInternalFrame frame = new TestInternalFrame();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.setSize(400, 400);
              frame.setVisible(true);
    }

  • How to fix the position of JInternal frames added in JFrame

    Hay Frnds, I am having a problem. I have a JFrame ,in which i have added five JInternalFrames. My problem is that i want to fix the position of thaose Internal frames so that user cant move them from one place to other. Is there any way to fix there position. Plz reply as soon as possible. Its very urgent.
    Thanks.

    In Jframe I added one rootPanelI don't know what a rootPanel is or why you think you need to add one.
    The general code should probably be something like:
    frame.add(userPanel, BorderLayout.CENTER);
    frame.add(buttonPanel, BorderLayout.SOUTH);
    frame.pack();Read the section from the Swing tutorial on [Using Layout Managers|http://java.sun.com/docs/books/tutorial/uiswing/TOC.html] for more information and working examples.
    For more help create a [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://sscce.org], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • Remove Focus from Main Frame after Jinternal Frame is opened.

    Hi,
    I want to restrict the user to change any thing on main frame once the JInternalFrame is opened (you can see same effect when we execute JOptionPane where focus on main is not retain untill you close the JOptionPane).
    I have written following code to listen the JInternalFrame event
    conn_prop.addInternalFrameListener(new InternalFrameListener(){
    @Override
    public void internalFrameActivated(InternalFrameEvent e) {
    // TODO Auto-generated method stub
    @Override
    public void internalFrameClosed(InternalFrameEvent e) {
    // TODO Auto-generated method stub
    @Override
    public void internalFrameClosing(InternalFrameEvent e) {
    // TODO Auto-generated method stub
    @Override
    public void internalFrameDeactivated(InternalFrameEvent e) {
    // TODO Auto-generated method stub
    @Override
    public void internalFrameDeiconified(InternalFrameEvent e) {
    // TODO Auto-generated method stub
    @Override
    public void internalFrameIconified(InternalFrameEvent e) {
    // TODO Auto-generated method stub
    @Override
    public void internalFrameOpened(InternalFrameEvent e) {
    // TODO Auto-generated method stub
    }}); I tried setEnabled(false) but this is paralyzing entire application
    what piece of code should i write to do that........
    thanks in advance.

    That is not how a JInternalFrame is meant to be used. Read the Swing tutorial on "Using Internal Frames".
    Use a modal JDialog.

  • Setting the font of the titlebar of JInternal Frames??

    hi all,
    i am trying to change the font of the titles of JinternalFrames..
    i have tried it but cant p*** compilation..
    i have done.. title.setFont(X,X,X);
    is it possible to set the fonts of titlebars of frames?
    If i cant do it like this, is there another way around this?
    thank u ..

    If you tried it and it doesn't work, then that likely means they work the same as JFrames, where the title bar is rendered by the operating system and not by Java. If you are using Windows, that means you have to go into the Control Panel and adjust the Display properties to change the font.

  • Jtree leaf selection on jinternal frame

    Hi all,
    I m using a splitpane ...on left hand side i m using a tree and right side i m using a desktoppane where i'll open the internal frames...my tree leaf and internalframe title is same ...
    my question is when when i select any internalframe it should select corresponding leaf(becoz my leaf and t\internalframe is same)...and same i wanna do for tree when i click in any leaf ...internal frame should actived and come to front...
    pls can anyone tell me how to proceed for this...
    can anyone provide me any examples ....pls help me out
    regards
    Tarique

    Since you have a reference to a DefaultMutableTreeNode object, can't you do something like
    TreeNode[] nodes = n.getPath();
    TreePath path = new TreePath(nodes);
    tree.setSelectionPath(path);

  • Modal JInternal Frames?

    Is there a possibility to create REAL custom modal JInternalFrames? I mean without using JOptionPane.showInternal.. since these cannot be customized in size, and dont return a reference.
    felix

    i believe what they were referring to is that you should not use a JDialog AS an internal frame and that you should use the JOptionPane and JInternalFrame classes.
    in your case, it is still perfectly fine to pop up a modal JDialog to ask for user input...
    and i'm pretty sure you were referring to the argument between myself and James. and you are perfectly fine as your question is general enough to not need code. :)

  • Drawing in Jinternal frames

    I have a frame using a JDesktopPane and it contains
    a varying number of JInternalFrames.
    I just want to draw onto the
    JInternalFrames.
    Do i place a large JPanel as a child in the JInternalFrame class?
    To i draw directly to the desktop?

    I just want to draw onto the JInternalFrames.what exactly do you mean by this? do you want to draw 'inside' the frames or on top of all frames?
    Do i place a large JPanel as a child in the JInternalFrame class?if you want to draw inside the frame, yes
    To i draw directly to the desktop? if you want to draw on top the frames, yes
    be a bit more specific pls.

  • Using JMF in JInternal Frames

    Hello,
    I'm am using several JInternalFrames within a desktop pane. Some of these frames have a JMF visual component.
    Is it possible to ensure that if internal frames are selected that they are not obscured by a visual component on other frames??? It seems that the JMF visual component is heavyweight and is thus always on top of anything else.
    thanks,
    Oli Gosling

    Hello Oli,
    I have the same problem. I've tried a lot of things (like adding to panels instead of a getGetContentPane, to send back etc.), but I still can not send to back the Visual Component (as if it is on the glass pane of the JDesktopPane).
    Have you found a solution or should I think of some tabbed pane or splitted panes or even individual frames?
    thanks,
    stefan.
    PS: it may be a bug?

  • Can we use GridBagLayout in JInternal Frame

    i've a question that can we use gridbaglayout in JInternalFrame?

    Yes:
    internalFrame.getContentPane().setLayout(new GridBagLayout());
    // Add children to be laid out to internalFrame,getContentPane()
    //or if you prefer:
    JPanel p = new JPanel(new GridBagLayout());
    internaleFrame.getContentPane().add(p);
    // Add children to be laid out to 'p'
    //

Maybe you are looking for