Setting thin titlebar on a JFrame

Hi,
I'm using JFrame for my non-modal dialogs.
What I want is to be able to set the height of the toolbars to be half of what they currently are, and making corresponding changes to the font used and the minimize\maximize/close buttons so that they fit too.
None of the functionallity (move, resize etc) should be affected.
I've looked for ages to find a solution to this, but only found out how to remove the toolbar completely, not just reduce it's height.
Thanks for any help you can give me!

I think you might be out of luck. Generally the title bar and its associated buttons
are under the control of the windowing system. You may be able to use JNI to
talk with some of the particularly configurable window managers under X, but
I suspect you are completely OOL with regards to Windows; I've no clue about
Mac.
: jay

Similar Messages

  • How to set a location of a JFrame using mouseListener?

    Hi,
    I was wondering how i could set the location of a JFrame using the mouseListener? I know when i want to show a JPopMenu i can do:
    pop.setLocation(e.getX(), e.getY());
    pop.setInvoker(null);
    By using .setInvoker(); I can show the jpopup on the position that i clicked my mouse but this method is not available to the JFrame.
    Should i do this with the Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); instead? I was wondering if there is an easier way to do this. If not i can code a workaround but thats not my first choice.
    Thanks

    CaptainMorgan08 wrote:
    deAppel wrote:
    CaptainMorgan08 wrote:
    Why do you need setInvoker() for a JFrame? What's wrong with just setLocation()?The problem is that i want to show my frame where i clicked my mouse but when i get the x,y from the mouselistener getX/Ymethods the frame doesn't show up on the location where i clicked with the mouse, instead it shows the frame in the location x,y NOT relative to the mouse.I see. Well if you're using Java 6, you can use the getXOnScreen() and the getYOnScreen() methods from MouseEvent.
    http://java.sun.com/javase/6/docs/api/java/awt/event/MouseEvent.html#getXOnScreen()
    Otherwise you'll need to add the x and y coordinates of whatever component you're clicking on.I'm using Java 6, I tried your suggestion but i get the same value with getX/Y and getX/YOnScreen()

  • How to set background color for a JFrame

    Hi,
    i am new to swing programming. I have created a JFrame called framehelp and i placed some labels in the frame.
    I have set the background color as yellow for the frame ie by setBackground(new java.awt.Color(255, 255, 204));
    But after compiling the program i am still getting the background color of frame as gray.
    How can i change the background color of frame as lightish yellow.
    I have used NETBEANS to generate this code and i am posting the code..
    Kindly help me
    Thanks in adavance
    public class framehelp extends javax.swing.JFrame {
        /** Creates new form framehelp */
        public framehelp() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            jLabel4 = new javax.swing.JLabel();
            jLabel5 = new javax.swing.JLabel();
            jLabel6 = new javax.swing.JLabel();
            jLabel8 = new javax.swing.JLabel();
            jLabel9 = new javax.swing.JLabel();
            jLabel10 = new javax.swing.JLabel();
            jLabel11 = new javax.swing.JLabel();
            jLabel12 = new javax.swing.JLabel();
            jLabel13 = new javax.swing.JLabel();
            jLabel7 = new javax.swing.JLabel();
            jLabel14 = new javax.swing.JLabel();
            jLabel15 = new javax.swing.JLabel();
            jLabel16 = new javax.swing.JLabel();
            jLabel17 = new javax.swing.JLabel();
            jLabel18 = new javax.swing.JLabel();
            jLabel19 = new javax.swing.JLabel();
            jLabel20 = new javax.swing.JLabel();
            jLabel21 = new javax.swing.JLabel();
            jLabel22 = new javax.swing.JLabel();
            jLabel23 = new javax.swing.JLabel();
            jLabel24 = new javax.swing.JLabel();
            jLabel25 = new javax.swing.JLabel();
            jLabel26 = new javax.swing.JLabel();
            jLabel27 = new javax.swing.JLabel();
            jLabel28 = new javax.swing.JLabel();
            jLabel29 = new javax.swing.JLabel();
            jLabel30 = new javax.swing.JLabel();
            jLabel31 = new javax.swing.JLabel();
            jLabel32 = new javax.swing.JLabel();
            jLabel33 = new javax.swing.JLabel();
            getContentPane().setLayout(null);
            setBackground(new java.awt.Color(255, 255, 204));
            setForeground(new java.awt.Color(204, 204, 204));
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            jLabel1.setText("The CAME framework software measurement process evaluation is used to determine the Level of  measurement in the ITarea. This measurementprocess evaluation is ");
            getContentPane().add(jLabel1);
            jLabel1.setBounds(40, 50, 41, 16);
            jLabel2.setText("performed individually for software coomponents ie SoftwareProduct, SoftwareProcess and SoftwareResource.");
            getContentPane().add(jLabel2);
            jLabel2.setBounds(40, 70, 41, 16);
            jLabel3.setText("Below we describe the steps which will guide through the measurement process evaluation. There are two types of evaluation considerd here, General evaluation");
            getContentPane().add(jLabel3);
            jLabel3.setBounds(40, 100, 913, 16);
            jLabel4.setText("and Evaluation with respect to a standard. The measurement intensions considerd by varoius measurement standards will be used in our tool based method.  ");
            getContentPane().add(jLabel4);
            jLabel4.setBounds(40, 120, 893, 16);
            jLabel5.setText("Information about the measurement standards can be found at     www.iso.org ,    www.ieee.org.");
            getContentPane().add(jLabel5);
            jLabel5.setBounds(40, 140, 542, 16);
            jLabel6.setText("Steps to calculate the MetricsLevel");
            getContentPane().add(jLabel6);
            jLabel6.setBounds(40, 190, 199, 16);
            jLabel8.setText("2 )  The opened frame consists of several  metrics and measures, evaluation level buttons, result textfields and selection choice lists. To calculate");
            getContentPane().add(jLabel8);
            jLabel8.setBounds(70, 240, 41, 16);
            jLabel9.setText("general Metricslevel without any standard, select general from Measurement standard choice list. then select Both from scaleType choice list and finally select metrics ");
            getContentPane().add(jLabel9);
            jLabel9.setBounds(90, 260, 949, 16);
            jLabel10.setText(" and measures from the frame and press MetricsLevel Button. The metricslevel for the selected metrics will be displayed in textfield1.");
            getContentPane().add(jLabel10);
            jLabel10.setBounds(90, 280, 756, 16);
            jLabel11.setText("3 ) To determine MetricsLevel with respect to a standard select a standard from MeasurementStandard choice list, select Both from ScaleType choice list and finally ");
            getContentPane().add(jLabel11);
            jLabel11.setBounds(70, 300, 933, 16);
            jLabel12.setText("select darkened metrics and measures and press MetricsLevel Button. The Metrics Level for the selected Metrics and standard will be diplayed in textfield1.");
            getContentPane().add(jLabel12);
            jLabel12.setBounds(90, 320, 883, 16);
            jLabel13.setText("4 ) Repeat steps 1 2, 3  for ProcessMeasurementEvaluation and ResourceMeasurementEvaluation menu items from the select menu.");
            getContentPane().add(jLabel13);
            jLabel13.setBounds(70, 340, 751, 16);
            jLabel7.setText("1 ) Select ProductMeasurementEvaluation menu item from the select menu,a frame called CAME framework software product measurement evaluation will be opened. ");
            getContentPane().add(jLabel7);
            jLabel7.setBounds(70, 220, 946, 16);
            jLabel14.setText("Steps to calculate MeasurementLevel");
            getContentPane().add(jLabel14);
            jLabel14.setBounds(50, 390, 214, 16);
            jLabel15.setText("1 ) Select ProductMeasurementEvaluation menu item from the select menu,a frame called CAME framework software product measurement evaluation will be opened.");
            getContentPane().add(jLabel15);
            jLabel15.setBounds(80, 420, 943, 16);
            jLabel16.setText("2 ) The opened frame consists of several  metrics and measures, evaluation level buttons, result textfields and selection choice lists. To calculate");
            getContentPane().add(jLabel16);
            jLabel16.setBounds(80, 450, 822, 16);
            jLabel17.setText("general Measurementlevel without any standard, select general from Measurement standard choice list. then select Quantitative measures from scaleType choice list ");
            getContentPane().add(jLabel17);
            jLabel17.setBounds(100, 470, 943, 16);
            jLabel18.setText("and finally select metrics and measures from the frame and press MeasurementLevel Button. The MeasurementLevel for the selected metrics will be displayed in textfield2.");
            getContentPane().add(jLabel18);
            jLabel18.setBounds(100, 490, 973, 20);
            jLabel19.setText("3 ) To determine MeasurementLevel with respect to a standard select a standard from MeasurementStandard choice list, select Quantitative measures from ScaleType choice list");
            getContentPane().add(jLabel19);
            jLabel19.setBounds(80, 510, 1009, 16);
            jLabel20.setText("and finally select darkened metrics and measures and press MeasurementLevel Button. The MeasurementLevel  will be diplayed in textfield2.");
            getContentPane().add(jLabel20);
            jLabel20.setBounds(100, 530, 799, 16);
            jLabel21.setText("4 )Repeat steps 1 2, 3  for ProcessMeasurementEvaluation and ResourceMeasurementEvaluation menu items from the select menu.");
            getContentPane().add(jLabel21);
            jLabel21.setBounds(80, 550, 748, 16);
            jLabel22.setText("Steps to calculate MeasurementProcessLevel");
            getContentPane().add(jLabel22);
            jLabel22.setBounds(50, 600, 262, 16);
            jLabel23.setText("1 ) Select ProductMeasurementEvaluation menu item from the select menu,a frame called CAME framework software product measurement evaluation will be opened.");
            getContentPane().add(jLabel23);
            jLabel23.setBounds(80, 630, 943, 16);
            jLabel24.setText("2 )The opened frame consists of several  metrics and measures, evaluation level buttons, result textfields and selection choice lists. To calculate");
            getContentPane().add(jLabel24);
            jLabel24.setBounds(80, 650, 819, 16);
            jLabel25.setText("general MeasurementProcesslevel without any standard, select general from Measurement standard choice list. then select Quantitative measures from scaleType ");
            getContentPane().add(jLabel25);
            jLabel25.setBounds(100, 670, 930, 16);
            jLabel26.setText("choice list, enter migrated metrics if any in textfield  below migrated metrics label and finally select metrics measures from the frame and press ");
            getContentPane().add(jLabel26);
            jLabel26.setBounds(100, 690, 818, 16);
            jLabel27.setText("MeasurementProcessLevel Button. The MeasurementProcessLevel for the selected metrics will be displayed in textfield3.");
            getContentPane().add(jLabel27);
            jLabel27.setBounds(100, 710, 691, 16);
            jLabel28.setText("3 ) To determine MeasurementProcessLevel with respect to a standard select a standard from MeasurementStandard choice list, select Quantitative measures from ");
            getContentPane().add(jLabel28);
            jLabel28.setBounds(80, 740, 937, 16);
            jLabel29.setText("from ScaleType choice list, enter migrated metrics if any in textfield below migrated metrics and finally select darkened metrics and measures and press  ");
            getContentPane().add(jLabel29);
            jLabel29.setBounds(100, 760, 873, 16);
            jLabel30.setText("MeasurementProcessLevel Button. The MeasurementprocessLevel for the selected metrics will be displayed in textfield3");
            getContentPane().add(jLabel30);
            jLabel30.setBounds(100, 780, 687, 16);
            jLabel31.setText("4 ) Repeat steps 1,2,3 for ProcessMeasurementEvaluation and ResourceMeasurementEvaluation menuitems.");
            getContentPane().add(jLabel31);
            jLabel31.setBounds(80, 800, 618, 16);
            jLabel32.setText("Steps to calculate MeasuredSoftwareProcessLevl");
            getContentPane().add(jLabel32);
            jLabel32.setBounds(60, 830, 285, 16);
            jLabel33.setText("1 ) Follow the same steps as MetricsLevel calcualtion but select metrics and measures covered by CAME Tools only.");
            getContentPane().add(jLabel33);
            jLabel33.setBounds(90, 860, 657, 16);
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-1100)/2, (screenSize.height-940)/2, 1100, 940);
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            new framehelp().show();
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel10;
        private javax.swing.JLabel jLabel11;
        private javax.swing.JLabel jLabel12;
        private javax.swing.JLabel jLabel13;
        private javax.swing.JLabel jLabel14;
        private javax.swing.JLabel jLabel15;
        private javax.swing.JLabel jLabel16;
        private javax.swing.JLabel jLabel17;
        private javax.swing.JLabel jLabel18;
        private javax.swing.JLabel jLabel19;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel20;
        private javax.swing.JLabel jLabel21;
        private javax.swing.JLabel jLabel22;
        private javax.swing.JLabel jLabel23;
        private javax.swing.JLabel jLabel24;
        private javax.swing.JLabel jLabel25;
        private javax.swing.JLabel jLabel26;
        private javax.swing.JLabel jLabel27;
        private javax.swing.JLabel jLabel28;
        private javax.swing.JLabel jLabel29;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel30;
        private javax.swing.JLabel jLabel31;
        private javax.swing.JLabel jLabel32;
        private javax.swing.JLabel jLabel33;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JLabel jLabel6;
        private javax.swing.JLabel jLabel7;
        private javax.swing.JLabel jLabel8;
        private javax.swing.JLabel jLabel9;
        // End of variables declaration
    }

    1. When you post code, post a minimal example. Did we have to scroll through
    all those bloody labels.
    2. Can't say much for the quality of code NetBeans generates.
    3. To answer your question (sorry, I don't have an autographed copy of the photo):
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class Example {
        public static void main(String[] args) throws MalformedURLException {
            final JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container cp = f.getContentPane();
            cp.setBackground(new Color(0xff, 0xff, 0xee));
            cp.add(new JLabel("set the color on the content pane, not the frame"), BorderLayout.SOUTH);
            URL url = new URL("http://today.java.net/jag/bio/JagHeadshot-small.jpg");
            cp.add(new JLabel(new ImageIcon(url)));
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • How to set  a Visual "Mac" to JFrame

    Hi all,
    How can I set a LookAndFeel of Mac to a JFrame? (Using the JDK 5 and Windows).
    since already thanks.

    How was my response rude, besides pointing out the technical impossibility of using native Mac LAF on Windows box and vice versa? And how was it unhelpful if it pointed out the exact reason why it's not possible?

  • Set size JPanel inside a JFrame

    I�m trying to set the size of a custom JPanel inside of a custom JFrame
    my code looks like this
    public class myFrame extends JFrame
        public myFrame()
         //This set the size of JFrame but i dont want this
            //setSize(300,600);
            //add panel to frame
            MyPanel panel = new myPanel();
            Container contentPane = getContentPane();
            contentPane.add(panel);
    class MyPanel extends JPanel
         public MyPanel()
              setSize(300, 600); //This don�t work, why??
              validate();
    }Why wont setSize(300, 600) work inside class myPanel ???

    @Op
    You need to read a tutorial on layout managers. It looks like you don't know how they work.
    The panel should call setPreferredSize, and the frame should call pack just before you are displaying the frame.
    Kaj

  • How to set focus on opened new JFrame??

    Hi,
    I have a problem:
    I have my active JFrame that I am currently running.
    When I press a JButton I have an action that it opens another JFrame,
    which is minimized (maybe it doesn't have a focus enabled or something)
    How to make the opening JFrame window maximized and make it be the one on the foreground (put the first JRame in background)
    Thanks

    Try this:
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    public class JFrames extends JFrame{
         public JFrames(){
              super();
              // exit on close
              this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // button to create new JFrame
              JButton button = new JButton("New Frame");
              button.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e){
                        // create new instance and maximize it
                        JFrames frame = new JFrames();
                        frame.setExtendedState(frame2.getExtendedState()|frame2.MAXIMIZED_BOTH);
              // panel to add the button to
              JPanel panel = new JPanel();
              panel.setPreferredSize(new Dimension(300, 200));
              panel.add(button);
              this.getContentPane().add(panel);
    // display the frame
    this.pack();
    this.setVisible(true);
         public static void main(String args[]){
              JFrames frames = new JFrames();
    }

  • How to create similar  titlebar as in JFrame?

    Hello
    i need to create titlebar for my JPanen but only with minimalization button.
    can somebody tell me how?

    Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.

  • How to set Minimum size of JFrame?

    Hi,
    I want to set minimum size of my JFrame. How can i set it?
    I want to maintain a minimum size while resizing the JFrame. The user should not resize beyond the minimum size of JFrame.
    Any body knows solution, please post it.
    Thanks in Advance.

    One posible solution is to add a ComponentListener to the
    JFrame that implements ... (struggles to remember) ...
    componentResized().
    Inside componentResized(), check the size of your JFrame,
    and if it is smaller than your preferred minimal dimension,
    resize it up to your minimum.
    // in the constructor, perhaps, or initialization routine
    addComponentListener(
      newComponentAdapter()
        public void componentMoved(ComponentEvent e)
            Dimension size = e.getComponent().getSize();
            size.width = Math.max(size.width, myMinimalWidth);
            size.height = Math.max(size.height, myMinimalHeight);
            e.getComponent.setSize(size);
      }); Pity there's no setMinimumSize() like the JComponent class.
    Best of luck !
    Eric

  • Setting JFrame Image Background

    Hi everyone, I'm kind of new to Java programming and so far I haven't been able to find a way to set the background of a JFrame to an image. I already know how to change the color but I need to set an image to the background and not just a color. So I was wondering if anybody knew where to find a simple tutorial or instructions on how to do this or if someone could simply explain it.
    Thanks for the help :)
    Edited by: neptune692 on May 3, 2009 1:37 PM

    Swing related questions should be posted in the Swing forum.
    I haven't been able to find a way to set the background of a JFrame to an imageReally? Thats hard to believe as this is one of the most common questions in the forum. What search keywords did you use? Maybe the last two (or three) words from your topic title would be a good start. And searching the Swing forum would be a good idea.
    I'm partial to my [Background Panel|http://www.camick.com/java/blog.html?name=background-panel] solution which does what the above postings suggest, plus provide a few other image painting options.

  • Setting the Background Graphics for a JFrame

    Hi,
    I am designing a GUI-based game and intend to set the background of my JFrame to a specific jgp graphic...I can't seem to find any method for setting the background in the JFrame API.
    Kindly assist!
    Cheers.

    Your search is perhaps marred by being too specific to frame. It is generally considered a bad idea to do any 'custom' thing directly to a frame. Try this search instead.
    [http://www.google.com/search?q=background+panel+java]

  • Set name of JFrame in Netbeans

    Hi,
    I am using the GUI builder in netbeans to create my application.
    This means that all the components are created in InitComponents() and I cannot access these components to change them.
    What I need to be able to do is to give my JFrame a name so that I can set properties on the Frame.
    Ultimately what I want to be able to do is to change the IconImage on top left.( I do not want to use the properties window to do this)
    I want to be able to say something like frame.iconImage("icon.gif");
    So how do I set the name of the JFrame in Netbeans?
    Thanks in Advance.

    I'm assuming that your class extends JFrame, so you can just call this.<whichever method you want> from any method or constructor of your class.

  • How to set the fix size jframe window

    when I run the jframe ,the jframe window size is very small
    1)how to set the fix size jframe window??
    2)how to set the jframe cannot change the window size??
    thx~~

    1. You can set the size by calling JFrame's method setSize. There are two versions of this method: (1) setSize(int width, int height) and (2) setSize(Dimension d). Note, that when you use this method to set the frame size, you don't have to call JFrame's pack method.
    2. JFrame has a method called setResizable(boolean resizable) which you can call with the argument false.
    Without any ill intent, these questions are regarding something that is very easily answered by looking at the documentation for the JFrame class. I suggest to anyone working with swing to at least look briefly through the base classes they're extending before giving up. In my experience it is always more gratifying to figure things out on my own than asking someone. But please don't take this the wrong way, I respect people who seek out help in order to further their knowledge, instead of just giving up.

  • How to do flashing titlebar's JFrame

    I'm developing a chat Application and have to notify users when a new message is Arriving.
    How to do for flashing titlebar of the JFrame message Window?
    thanks greatly some smarter help.

    That's a good question but I don't think that's possible unless you use a modal dialog or something. Here
    are some other options though: why not make the frame come to the front of all windows when a new
    message comes kind of like the messenger service? You can make the frame's content flash maybe?
    you can sound an alarm maybe? Use combinations of these suggestions maybe?

  • JFrame.setCursor (not setting cursor)

    I'm creating an application where I need to run an expensive operation. I've set it up to use a SwingWorker type of deal.
    What I do is listen for the button to be clicked. It then sets the cursor on the parent JFrame to the wait cursor and then starts the Worker Thread.
    The worker Thread runs it's process and resets the cursor to the default.
    However, when I set the cursor on the JFrame, I only notice the change when I mouseover the clicked button.
    There are a lot of components in the application I really don't want to have to go through and set the cursor for each component manually.
    Any help would be greatly appreciated.
    Thanks,
    Eric
    My actionPerformedMethod.
       public void actionPerformed(ActionEvent e) {
          Object source = e.getSource();
          if(source instanceof Component) {
             Component root = SwingUtilities.getRoot((Component)source);
             if(root instanceof JFrame) {
                int winW = root.getWidth();
                int winH = root.getHeight();
                compilingLabel.setLocation((winW - labelSize.width) / 2, (winH - labelSize.height) / 2);
                ((JFrame)root).getLayeredPane().setLayer(compilingLabel, JLayeredPane.POPUP_LAYER.intValue());
                ((JFrame)root).getLayeredPane().add(compilingLabel, JLayeredPane.POPUP_LAYER);
                ((JFrame)root).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                root.repaint();
                root.setVisible(true);
                new CompileThread(e).start();
       }I've also tried using getWindowAncestor with the same results.

    I always use the JFrame's glasspane to do this. You set the hourglass cursor on the glasspane, and you must also register a MouseListener on the glasspane (the MouseListener doesn't have to do anything, but you must still have it there. Don't ask me why.). When you want to show the hourglass cursor you call setVisible(true) on the glasspane, and to display the normal cursor you call setVisible(false) on it. To sum it up:
    // Set the cursor on the glasspane and register an empty MouseListener:
    frame.getGlassPane().setCursor( Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) );
    frame.addMouseListener( new MouseAdapter() {} );
    // To display the hourglass cursor:
    frame.getGlassPane().setVisible(true);
    // To restore the normal cursor:
    frame.getGlassPane().setVisible(false);Hope this helps.

  • Image setting in JFrame

    The following code is for setting an image in my JFrame..
    import java.awt.*;
    import javax.swing.*;
    class FA extends JFrame
         JFrame frmMain=new JFrame("Test");
         Graphics g;
         FA()
              frmMain.setDefaultLookAndFeelDecorated(true);
              g=frmMain.getGraphics();
              frmMain.setResizable(false);
              frmMain.setBounds(20,60,700,460);
              frmMain.getContentPane().setLayout(null);
              frmMain.setVisible(true);
              g=frmMain.getGraphics();
              Graphics2D g2d=(Graphics2D)g;
              g2d.setStroke(new BasicStroke(2.0f));
              g2d.drawRect(30,60,420,340);
              Image i=new ImageIcon("images\\marea.gif").getImage();
              g.drawImage(i,30,60,420,340,this);
         public static void main(String args[])
              FA f=new FA();
    By using this code i can set an image into my frame... but when i take the frame after once minimizing it will not display the image...
    how to overcome this problem??

    To make a slight change, I recommend calling super.paintComponent at the beginning to allow the JPanel to paint itself first:
        class MyJPanel extends JPanel
            public void paintComponent(Graphics g)
                super.paintComponent(g);
                g.drawImage(theimage, 0, 0, this);
        }

Maybe you are looking for

  • K7T Turbo-R Limited Edition W/Raid

    Two questions, first how do you tell if your XP 1800+ is a palomino? I purchased one but all it says is AMD Athlon XP 1800+ on the factory sticker. Second when I use this processor with my K7T Turbo-R Limited W/Raid it will boot up fine, displays the

  • IMovie File Structure and HD Optimization

    Hi, I'm a new Mac user, recently from the Windows world where I did a lot of video editing and am now keen to get started with iMovie. I have a large external HD where I'm hoping to store my large video files in order to conserve space on my MacBook

  • EBS R12 - Forms Patch 10.1.2.3 failing

    Hello All I am trying to apply Forms patch 10.1.2.3 as part of 12.1.1 upgrade and installer is failing with these errors in inventory log files below. Is my inventory wrong?. I have recreated central inventory. And I don't have Components directory i

  • What is the logic to know whether the GRN is done for PO or not?

    Hi How to write a code to know whether the GRN is done for PO or not? Regards Smitha

  • RFC to ISO 20022 xml file scenario

    Hello Experts, I have a scenario in which i need to pull data from SAP and create ISO 20022 xml file. I have no idea about ISO 20022 xml file format. Can anybody send me the links which have examples of how to achive that through XI? Thanks, Hetal