764 Graphical User Interface Components: Part (Business web hosting) 2 Chapter

764 Graphical User Interface Components: Part 2 Chapter 13 54 // attach internal frame to desktop and show it 55 theDesktop.add( frame ); 56 frame.setVisible( true ); 57 } 58 59 } // end anonymous inner class 60 61 ); // end call to addActionListener 62 63 setSize( 600, 440 ); 64 setVisible( true ); 65 66 } // end constructor 67 68 // execute application 69 public static void main( String args[] ) 70 { 71 DesktopTest application = new DesktopTest(); 72 73 application.setDefaultCloseOperation( 74 JFrame.EXIT_ON_CLOSE ); 75 } 76 77 } // end class DesktopTest 78 79 // class to display an ImageIcon on a panel 80 class MyJPanel extends JPanel { 81 private ImageIcon imageIcon; 82 83 // load image 84 public MyJPanel() 85 { 86 imageIcon = new ImageIcon( “jhtp4.png” ); 87 } 88 89 // display imageIcon on panel 90 public void paintComponent( Graphics g ) 91 { 92 // call superclass paintComponent method 93 super.paintComponent( g ); 94 95 // display icon 96 imageIcon.paintIcon( this, g, 0, 0 ); 97 } 98 99 // return image dimensions 100 public Dimension getPreferredSize() 101 { 102 return new Dimension( imageIcon.getIconWidth(), 103 imageIcon.getIconHeight() ); 104 } 105 106 } // end class MyJPanel Fig. 13.13 Fig. 13.13 Creating a multiple document interface (part 2 of 3).
Note: If you are looking for cheap webhost to host and run your apache application check Vision jboss web hosting services

Leave a Reply