Sunday, November 1, 2009

Cubefield Smal Screen

Class

image For JInternalFrame class inheritance and its descendant classes (subclasses direct) can use the data and / or methods of the JComponent superclass Bookseller superclasses swing and container, and Component Object Bookseller awt.
This class allows light objects that provide many of the characteristics of a frame, including the posting, closure, insertion of icons, resizing, title and support for a menu bar.
The contentPane is managed by an instance of the class JRootPane, which handles distribution of objects and a menu bar option for the internal frame.
is recommended to place a JDesktopPane internal frames.

I. - CLASS HIERARCHY
image
II .- METHODS

ago Int boolean Gets Boolean Void Send
BUILDERS
Constructor
Description
JInternalFrame ()
Create an internal frame is not resizable not lockable, not maximize, iconify, untitled no.
JInternalFrame (String title)
Create an internal frame is not resizable, closable no, not maximize, and iconify not indicated as the title parameter.
JInternalFrame (String title, boolean resizable)
Create an internal frame is not lockable, not maximize, iconify but no title and scalable.
JInternalFrame (String title, boolean resizable, boolean closable)
Create an internal frame does not maximize, iconify but no title, resizable, and closable along the lines indicated.
JInternalFrame (String title, boolean resizable, boolean closable, boolean maximize)
Create an internal frame iconify but no title, resizable, closable and maximizable along the lines indicated.
JInternalFrame (String title, boolean resizable, boolean closable, boolean maximizable, boolean iconify)
Create an internal frame title, resizable, closable, maximize, and iconify.
METHODS
Return Type
Method
Description
void
dispose ()
the internal frame invisible, unselected and closed.
Container
getContentPane ()
Returns the content Pane

getDefaultCloseOperation ()
Returns the value of the transaction that occurs when the user closes the frame.
Component
getFocusOwner ()
If the JInternalFrame is active, returns the focused element.
Icon
getFrameIcon ()
Returns the icon displayed in the title line of the internal frame.
JMenuBar
getJMenuBar ()
returns the JMenuBar the internal frame, or null if not.
Component
getMostRecentFocusOwner ()
Returns the internal frame element was the focus when the frame was selected.
String
getTitle ()
Returns the title.
boolean
isClosed ()
Returns true if the internal frame is lockable, otherwise returns false.

isClosed ()
Returns true if the internal frame is closed, otherwise returns false.
boolean
isIcon ()
Returns true if the internal frame has icon, otherwise returns false.
boolean
isMaximizable ()
the property value maximized.
boolean
isMaximum ()
Returns true if the internal frame is maximized returns false otherwise.
boolean
isResizable ()
Returns true if the internal frame is resizable, otherwise returns false.

isSelected ()
Returns true if the internal frame is selected, otherwise returns false.
void
remove (Component comp)
removes the given component as a parameter of its container.
void
reshape (int x, int y, int width, int height)
Move and resize the internal frame to the value of the given parameters.
void
setClosable (boolean b)
lockable ago the internal frame if the parameter is true.
void
setClosed (boolean b)
Closes the internal frame if given parameter value is true.
void
setDefaultCloseOperation (int operation)
Define the operation should happen by default when the user closes the internal frame. The default is HIDE_ON_CLOSE. Other possible values \u200b\u200bare DO_NOTHING_ON_CLOSE and DISPOSE_ON_CLOSE
void
setFrameIcon (Icon icon)
Sets icon on the internal frame.
void
setJMenuBar (JMenuBar menu)
Sets the menu bar of the internal frame with the menu given as parameter.
void
setLayout (LayoutManager manager)
establishes a different distribution to that provided by default.

setMaximizable (boolean b)
Sets maximizable property through the given value as a parameter.
void
setMaximum (boolean b)
Maximize the internal frame.
void
setResizable (boolean b) Set
resized property through the given value as a parameter.
void
setSelected (boolean selected)
Selects or deselects the internal frame, as the parameter value.
void
setTitle (String title)
Sets the internal frame's title.
void
show ()
Shows the internal frame.
void
Toback ()
Send the inner frame forward.
void
toFront ()
the internal frame forward.

III .- EXAMPLES
  1. Design an application that allows, through internal frame to place a button inside the main frame. For each frame that is created must be assigned a number. In the bottom place another button to close all the frames that were closed.

    • create a new project to which we add a package and this package will add a JFrame Form Principal Name (To see how to create a NetBeans project visit this entry ).

      image
    • this frame will give you ownership of BorderLayout, for this click on the frame → → BorderLayout setLayout (if you want to know more about the layout visit this link ) once this place a JScrollPane in the center (use the left side look for the JScroolPane NetBeans and drag to center the frame) and above the place the JDesktopPane JScrollPane, then place two buttons one on the north and one south, so the project should be:

      image image

      numcommentsVE
      NOTE: The JDesktopPane is essential in a frame that will contain JInterlFrame. The scroll contains the content JDesktop because it may exceed its size and if the bar should appear displacement.

    • Once you create the interface, we create the logic of the program: go to the Source tab to go to the source code and declare two variables (an accountant and an initial position - which itwould will be the position in which appear the first JInternal Frame)
       public class Main extends javax.swing.JFrame 
      {private int counter = 1;
      private int position = 0;

      public Principal () {
      initComponents () ;
      setSize (400.400);}



    • returned to the design and double-click the Create button to set the action (we will btnCreaActionPerformed private void method (java.awt.event.ActionEvent evt) on which to place the following:

       btnCreaActionPerformed private void (java.awt.event.ActionEvent evt) {
      / / TODO add your handling code here:
      creaInternalFrame ();}

      creaInternalFrame public void () {
      JInternalFrame f = new JInternalFrame ("InternalFrame" + counter
      true, / / \u200b\u200bchange size
      true, / / \u200b\u200bcloses
      true, / / \u200b\u200bmaximize
      true / / collapsible
      )
      f.setLocation (position * 50 + 10, position * 50 +10);
      desktop.setPreferredSize (new Dimension (400 + (position * 50), 400 + (position * 50)) )
      f.setSize (200.150);
      f.setBackground (new Color (200,255,255 ));// desktop.add
      background color (f) / / placed on the desktop
      f.setVisible (true); / / makes it visible in the foreground
      counter + +;
      position + +;}



    • now return to the logic design to give the close button:
      private void
       btnCierraActionPerformed (java.awt.event.ActionEvent evt) {
      / / TODO add your handling code here:
      desktop.removeAll ();
      desktop.repaint ();
      counter = 1;
      position = 0;}



    • get it done this siguinente : image


    • If you wish to download the sample Skydrive visit my site (where you can find more examples - in the top menu to find the link -) or simply give him click the download button:


      btn_6



0 comments:

Post a Comment