Quickest way to clone a JPanel and its components?

Is there a quick method to clone a JPanel and its components?

This has been tried before and not work.
JVM reports errors :
clone() has protected access in java.lang.Object.

Similar Messages

  • Easy way to clone a Vector and its Content?

    I have a Vector containing String Arrays. I would like to clone the vector an all it's content.
    Just cloning the vector doesn't work, because just the vector gets cloned whereas the references to the StringArrays in the vector stay the same.
    So i guess i have to clone all the StringArrays too? This would be a very "expensive" process, so i'd like to ask first, if there is another methode to clone a vector and it's content?
    Thanks for your help!

    No. Clone gives you a shallow copy. What you want is a deep copy. However, since Strings are immutable, you only need to deeply copy the string arrays, not the strings themselves. If you were working with mutable objects, this would not be the case and you would need to copy the items in the array as well as the array itself.

  • Scaling jpanel and its components

    Hi all,
    I have a JPanel of size 600x600,which contains few buttons and textboxes.If i am reducing the panel size to 300x300, i want the components in the panel to get reduced in size and position relatively,so that all the components are visible.Is it possible to scale panel ,like scaling a image.
    Please help me.
    Thanks in advance
    Ravisenan

    Yes, it is possible.
    Go through the link
    A Visual Guide to Layout Managers
    http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html

  • Hi, i sent my 1st gen ipod to apple way back in november 2010 and its march now and i still haven't received the replacement, what do i do? life without music is -_-

    hi, i sent my 1st gen ipod to apple way back in november 2010 and its march now and i still haven't received the replacement, what do i do?
    life without music is -_-

    call apple because there may be an issue with the shipment you should have had the ipod replaced a long time ago
    APPLE
    1800-275-2273

  • How to print out a JPanel with its components

    Hello,
    I want to print out a JPanel where several components are placed in. The problem is just that neither the printAll() method nor the print() method works to do so. There's always just a print of the empty JPanel. Is there in general a possibility to print out a JPanel with its components or are I'm on the wrong way ?
    Thanx,
    Findus

    I just posted this link and it works here:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=361445&tstart=0&trange=15

  • Difference between the document total and its components in inventory transfer

    Hi Everyone!
    When I make Inventory Transfer, SAP notice error "There is difference between the document total and its components.".Everyone that knows this problem, Pls help to find way to solve it.
    Thanks & Best regards
    Ngoc Loan

    Hi,
    Please refer to the thread.
    There is a difference between the document total and its components
    Hope Helps!
    Regards,

  • I tried to download the itunes update and at first it would say i was missing msvcr80.dl so I completely uninstalled itunes and its components, then reinstalled it. Now it says I'm missing"Applle Application Support" How do I fix this?

    I tried to download the itunes update and at first it would say i was missing msvcr80.dl so I completely uninstalled itunes and its components, then reinstalled it. Now it says I'm missing"Applle Application Support" How do I fix this?

    With the Error 2, let's try a standalone Apple Application Support install. It still might not install, but fingers crossed any error messages will give us a better idea of the underlying cause of the issue.
    Download and save a copy of the iTunesSetup.exe (or iTunes64setup.exe) installer file to your hard drive:
    http://www.apple.com/itunes/download/
    Download and install the free trial version of WinRAR:
    http://www.rarlab.com/
    Right-click the iTunesSetup.exe (or iTunes64Setup.exe), and select "Extract to iTunesSetup" (or "Extract to iTunes64Setup"). WinRAR will expand the contents of the file into a folder called "iTunesSetup" (or "iTunes64Setup").
    Go into the folder and doubleclick the AppleApplicationSupport.msi to do a standalone AAS install.
    Does it install properly for you?
    If instead you get an error message during the install, let us know what it says. (Precise text, please.)

  • There is a difference between the document total and its components

    Hi!
    I have an error message "There is a difference between the document total and its components" when I want to create an InventoryGenEntry
    the problem arises from time to time and my customer must do the document two or three times before it is created.
    I have seen in this forum and in notes that this is probably being caused by a Rounding.
    I am using 2 digits for amounts, 4 digits for prices, 6 digits for rates and 3 digits for quantities.
    For information my customer use SAP 2005 and the patch level 46.
    This problem happened only in InventoryGenEntry. how can I modifiy parameters to resolve this problem?
    thank you for your help.
    Best Regards
    Séverine

    Hi Séverine,
    Do you find any additional code added to SBO_SP_Transaction stored procedure. A similar issue with stock transfer fixed in later patch. Please test in latest patch.
    Regards,
    Vijay kumar
    SAP Business One Forums Team

  • HT1923 im trying to unistall itunes and its components and is not letting me/

    im trying to unistall itunes and its components and is not letting me?

    Do you get error messages when doing the uninstalls? If so, what do they say? (Precise text, please.)

  • Another really easy one: Is there a way to compile a .vi and its dependenci​es into a standalone executable​?

    Hey, I'm using the Full Development System version 5.0.1, and I was wondering if I can take a VI and its dependencies and turn them into an executable which doesn't depend on Labview's being installed.
    Or if not, what is the minimum amount of Labview that needs to be installed in order to run a .Vi?
    Thanks,
    -Dobbs

    Use Application Builder to create an executable. I believe LV 5.0.1 is close to 5.1.1. You'd get a .exe file that you can distribute. Keep in mind that you need Run Time Engine installed in the machine that will run without the LabVIEW development system. I believe the run time engine is free. If you use the SQL toolkit, you'll need to get a run-time license for App Builder.
    In LV 5.1.1, under Project menu, select "Build Application".
    I'd generally build a single VI containing all the VIs but you can certainly link it to an external file. Both ways work.
    Under "Top Level VI", you'd need to specify the Top Level VI if you want the VI to execute automatically. Otherwise, it'll prompt you to select a VI to run.
    I hope that helps. Regards,
    Shan Pin Koh
    Systems Eng
    ineer
    Oakriver Technology

  • Enlarge JFrame and its components properties  proportionally

    Hi,
    We have a simple JFrame � Container - uses Flow Layout and has got Buttons, Text Fields� All of them are using Java�s default fonts, sizes..�
    And we want to increase or enlarge all of the JFrame and its sub components properties proportionally (especially Font�.) like in for example MS-Word.
    In the Ms-Word, there is ZOOM option in the Standard tool bar menu. If you set zoom to 150%, the font is automatically increases. And if you set it to 100% the font sets back to normal. And if the window is not enough to fit, it adds the scroll bars.
    For example, if we increase the Labels Font, the height of that component also should increase proportionally. So the Frame also should increase.
    How could we achieve this sort of functionality ( i.e. Proportionally increasing the component�s properties ) in Swing?
    I believe it is hard to set/adjust the all of the Frame�s components properties (I.e. Height, Font�) proportionally by using the Component listeners.
    (Another example, you might have noticed that the Frame�s Font, hight,width �sizes are proportionally bigger in Systems screen�s 800 by 600 pixels mode compare with 1024 by 768 pixels mode. May be this is windows feature. But we are looking at achieving the same sort of feature)
    Any help or thoughts would be appreciated.
    Thanks in advance.
    Vally.

    Here is a working sample:
    package ui_graphics;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.LayoutManager;
    import java.util.Arrays;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JSpinner;
    import javax.swing.SpinnerListModel;
    import javax.swing.SpinnerModel;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class ZoomableFrameTest {
       private ZoomablePanel zoomPanel;
       private JLabel label;
       public ZoomableFrameTest() {
          label = new JLabel("Essai pour le zoom");
          label.setBounds(0,0,200,16);
          zoomPanel = new ZoomablePanel();
          zoomPanel.add(label);
          JFrame frame= new JFrame("Zoom test");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().add(getZoomSpinner(), BorderLayout.NORTH);
          frame.getContentPane().add(zoomPanel, BorderLayout.CENTER);
          frame.pack();
          frame.setVisible(true);
       public static void main(String[] args) {
          new ZoomableFrameTest();
       public JSpinner getZoomSpinner() {
          String[] zoomValues = { "50", "100", "150" };
          SpinnerModel model = new SpinnerListModel(Arrays.asList(zoomValues));
          final JSpinner spZoom = new JSpinner(model);
          Dimension dim = new Dimension(60, 22);
          spZoom.setMinimumSize(dim);
          spZoom.setPreferredSize(dim);
          spZoom.setMaximumSize(dim);
          spZoom.setFocusable(false);
          spZoom.addChangeListener(new ChangeListener() {
             public void stateChanged(ChangeEvent e) {
                // R�cup�re le facteur d'�chelle
                int factor = Integer.parseInt((String)spZoom.getValue());
                setScaleFactor(factor);
          spZoom.setValue("100");
          return spZoom;
       private void setScaleFactor(int factor) {
          zoomPanel.setZoomFactor(factor);
    class ZoomablePanel extends JPanel {
       private int zoomFactor;
       public ZoomablePanel() {
          super(null);
       public void setZoomFactor(int factor) {
          this.zoomFactor = factor;
          if (this.isShowing()) this.repaint();
       public void paint(Graphics g) {
          super.paintComponent(g);
          double d = zoomFactor / 100d;
          Graphics2D g2 =(Graphics2D)g;
          g2.scale(d, d);
          super.paint(g2);
    }

  • I want the Definitaion fo  Class and its Components  in ABAP . With Example

    Gowri

    <b>Classes</b>
    Classes are templates for objects. Conversely, you can say that the type of
    an object is the same as its class. A class is an abstract description of an object. You could say that it is a set of instructions for building an object. The attributes
    of objects are defined by the components of the class, which describe the
    state and behavior of objects.
    <b>
    Local and Global Classes</b>
    Classes in ABAP Objects can be declared either globally or locally. You define global classes and interfaces in the Class Builder (Transaction SE24) in the
    ABAP Workbench. They are stored centrally in class pools in the class library
    in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes. Local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined. When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, it then looks for a global class. Apart from the visibility question, there is no difference between using a global class and using a local class.
    There is, however, a significant difference in the way that local and global classes are designed. If you are defining a local class that is only used in a single program, it is usually sufficient to define the outwardly visible components so that it fits into that program. Global classes, on the other hand, must be able to be used anywhere. This means that certain restrictions apply when you define the interface of a global class, since the system must be able to guarantee that any program using an object of a global class can recognize the data type of each interface parameter.
    The following sections describe how to define local classes and interfaces in an ABAP program. For information about how to define local classes and interfaces, refer to the  Class Builder section of the ABAP Workbench Tools documentation.
    <b>Defining Local Classes</b>
    Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS ... ENDCLASS. A complete class definition consists of a declaration part and, if required, an implementation part. The declaration part of a class <class> is a statement block:
    CLASS <class> DEFINITION.
    ENDCLASS.
    It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data. You should therefore place it at the beginning of the program.
    If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
    CLASS <class> IMPLEMENTATION.
    ENDCLASS.
    The implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding that is not itself part of a processing block is therefore not accessible.
    <b>Structure of a Class</b>
    <u>The following statements define the structure of a class:</u>
    A class contains components
    Each component is assigned to a visibility section
    Classes implement methods
    The following sections describe the structure of classes in more detail.
    <b>Class Components</b>
    The components of a class make up its contents. All components are declared in the declaration part of the class. The components define the attributes of the objects in a class. When you define the class, each component is assigned to one of the three visibility sections, which define the external interface of the class. All of the components of a class are visible within the class. All components are in the same namespace. This means that all components of the class must have names that are unique within the class.
    There are two kinds of components in a class - those that exist separately for each object in the class, and those that exist only once for the whole class, regardless of the number of instances. Instance-specific components are known as instance components. Components that are not instance-specific are called static components.
    In ABAP Objects, classes can define the following components. Since all components that you can declare in classes can also be declared in interfaces, the following descriptions apply equally to interfaces.
    <b>Attributes</b>
    Attributes are internal data fields within a class that can have any ABAP data type. The state of an object is determined by the contents of its attributes. One kind of attribute is the reference variable. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
    <b>Instance Attributes</b>
    The contents of instance attributes define the instance-specific state of an object. You declare them using the DATA statement.
    <b>Static Attributes</b>
    The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.
    All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.
    <b>Methods</b>
    Methods are internal procedures in a class that define the behavior of an object. They can access all of the attributes of a class. This allows them to change the data content of an object. They also have a parameter interface, with which users can supply them with values when calling them, and receive values back from them The private attributes of a class can only be changed by methods in the same class.
    The definition and parameter interface of a method is similar to that of function modules. You define a method <met> in the definition part of a class and implement it in the implementation part using the following processing block:
    METHOD <meth>.
    ENDMETHOD.
    You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules). You call methods using the CALL METHOD statement.
    <b>Instance Methods</b>
    You declare instance methods using the METHODS statement. They can access all of the attributes of a class, and can trigger all of the events of the class.
    <b>Static Methods</b>
    You declare static methods using the CLASS-METHODS statement. They can only access static attributes and trigger static events.
    <b>Special Methods</b>
    As well as normal methods, which you call using CALL METHOD, there are two special methods called CONSTRUCTOR and CLASS_CONSTRUCTOR, which are automatically called when you create an object (CONSTRUCTOR) or when you first access the components of a class (CLASS_CONSTRUCTOR).
    <b>Events</b>
    Objects or classes can use events to trigger event handler methods in other objects or classes. In a normal method call, one method can be called by any number of users. When an event is triggered, any number of event handler methods can be called. The link between the trigger and the handler is not established until runtime. In a normal method call, the calling program determines the methods that it wants to call. These methods must exist. With events, the handler determines the events to which it wants to react. There does not have to be a handler method registered for every event.
    The events of a class can be triggered in the methods of the same class using the RAISE EVENT statement. You can declare a method of the same or a different class as an event handler method for the event <evt> of class <class> using the addition FOR EVENT <evt> OF <class>.
    Events have a similar parameter interface to methods, but only have output parameters. These parameters are passed by the trigger (RAISE EVENT statement) to the event handler method, which receives them as input parameters.
    The link between trigger and handler is established dynamically in a program using the SET HANDLER statement. The trigger and handlers can be objects or classes, depending on whether you have instance or static events and event handler methods. When an event is triggered, the corresponding event handler methods are executed in all registered handling classes.
    <b>Instance Events</b>
    You declare instance events using the EVENTS statement. An instance event can only be triggered in an instance method.
    <b>Static Events</b>
    You declare static events using the CLASS-EVENTS statement. All methods (instance and static methods) can trigger static events. Static events are the only type of event that can be triggered in a static method.
    <u>See also Triggering and Handling Events.</u>
    <b>Types</b>
    You can define your own ABAP data types within a class using the TYPES statement. Types are not instance-specific, and exist once only for all of the objects in a class.
    <b>Constants</b>
    Constants are special static attributes. You set their values when you declare them, and they can then no longer be changed. You declare them using the CONSTANTS statement. Constants are not instance-specific, and exist once only for all of the objects in a class.
    <b>Visibility Sections</b>
    You can divide the declaration part of a class into up to three visibility areas:
    CLASS <class> DEFINITION.
      PUBLIC SECTION.
      PROTECTED SECTION.
      PRIVATE SECTION.
    ENDCLASS.
    These areas define the external visibility of the class components, that is, the interface between the class and its users. Each component of a class must be assigned to one of the visibility sections.
    <b>Public Section</b>
    All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.
    <b>
    Protected Section</b>
    All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it. Protected components form a special interface between a class and its subclasses. Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section.
    <b>Private Section</b>
    Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.
    <b>Encapsulation</b>
    The three visibility areas are the basis for one of the important features of object orientation - encapsulation. When you define a class, you should take great care in designing the public components, and try to declare as few public components as possible. The public components of global classes may not be changed once you have released the class.
    For example, public attributes are visible externally, and form a part of the interface between an object and its users. If you want to encapsulate the state of an object fully, you cannot declare any public attributes. As well as defining the visibility of an attribute, you can also protect it from changes using the READ-ONLY addition.
    "Example  :
    CLASS C_COUNTER DEFINITION.
      PUBLIC SECTION.
        METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,
                 INCREMENT_COUNTER,
                 GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.
      PRIVATE SECTION.
        DATA COUNT TYPE I.
    ENDCLASS.
    CLASS C_COUNTER IMPLEMENTATION.
      METHOD SET_COUNTER.
        COUNT = SET_VALUE.
      ENDMETHOD.
      METHOD INCREMENT_COUNTER.
        ADD 1 TO COUNT.
      ENDMETHOD.
      METHOD GET_COUNTER.
        GET_VALUE = COUNT.
      ENDMETHOD.
    ENDCLASS.
    The class C_COUNTER contains three public methods - SET_COUNTER, INCREMENT_COUNTER, and GET_COUNTER. Each of these works with the private integer field COUNT. Two of the methods have input and output parameters. These form the data interface of the class. The field COUNT is not outwardly visible.
    Reward   points  if it is usefull...
    Girish

  • How to ZOOM the JFrame and its components ?

    Hi
    I could not find any solution/suggestions for this, so I am asking help.
    I am adding multiple components (JLables, JtextFields and a JTable) in to Jpanel(s) and to a JFrame window and I want to add Zoom (+ or - ) functions.
    I don't want to take each and every component from JFrame/ JPanel(s) and resize or repaint.
    Is there any way, that you can increase and decrease the whole JFrame and JPanel's view so that the components, which are been added to them, look like their sizes are also increased / decreased?
    Any suggestions or help would be appreciated.
    Thanks.
    Regards,
    Vally.

    ok...
    god bless the "GlassPane"
    you can take a snapShot of your frame...
    draw it on your glassPane..
    and just use your glassPane
    to paint the image with the requested size...
    in this approach you cant press a button and to things..
    shay

  • Deploy an Application and its components

    I am using Weblogic 6.1, sp1, with Win2k.
    I am trying to deploy my application (myapp.ear) which has 3 components,
    2 webapp comp and an ejb component.
    I have the Myapp.ear file in <weblogic home>/config/baiju/application
    directory
    and the components are listed in the config.xml file as follows :
    <Application Deployed="true" Name="Baiju-WebLogic"
    Path=".\config\mydomain\applications\Baiju-WebLogic.ear">
    <WebAppComponent Name="Baiju-WebLogic-Backoffice"
    Targets="Baiju" URI="Baiju-WebLogic-Backoffice.war"/>
    <EJBComponent Name="Baiju-WebLogic-Ejb"
    Targets="Baiju" URI="Baiju-WebLogic-Ejb.jar"/>
    <WebAppComponent Name="Baiju-WebLogic-Store"
    Targets="Baiju" URI="Baiju-WebLogic-Store.war"/>
    </Application>
    The problem is, when I start the Server it does not deploy the application
    "Baiju", if I go to admin console
    I can see the application as deployed ("its checked") and also its 3
    components, but I am not able to access the pages.
    Also this problem is not consistent, it sometimes work, with absolutely no
    change made to anything, I just re-start the server.
    I have my server running in Production Mode.
    (-Dweblogic.ProductionModeEnabled=true)
    Any help is appreciated,
    Thanks.
    Baiju.

    have a very similar situation in which an ear file deployed thru' the
    console is NOT getting picked up on restart. The file has been copied to
    config/mydomain/applications but does NOT show up in the .wlnotdelete
    directory when I restart the server. When I deployed the ear file initially,
    it was all ok. The home interfaces showed up in the JNDI treee but on
    restart, everything disappeared. It is running in the production mode.
    BTW everything works fine when I deploy using a JAR.
    "Baiju Gajjar" <[email protected]> wrote in message
    news:[email protected]...
    Hi Mihir,
    I am not deloying the application through the console, I have an ear file
    which I have in
    <Weblogic home>\config\<myapp>\applications
    folder as Baiju-WebLogic.ear file. If I start the server in developmentmode
    it is able to deploy
    it properly. It should be able to deploy even in production mode as it is
    listed in the config.xml
    file. Also this deployment is not consistent, it some does deploy it and
    some times it doesn't.
    Thanks,
    Baiju.
    "Mihir Kulkarni" <[email protected]> wrote in message
    news:[email protected]...
    Please set the Loggin level to the highest value ie,StdoutSeverityLevel="64".
    This will give you detailed information about the individual components
    in
    the
    ear being deployed. The config.xml entries look fine to me.
    Are you deploying the applications through the console ? As you arerunning
    with the productionMode=enabled, the server would not pick up anythingfrom
    the applications dir unless you have deployed it through the console. Doyou
    face the same problem when you are running in the dev mode ?
    Baiju Gajjar wrote:
    I am using Weblogic 6.1, sp1, with Win2k.
    I am trying to deploy my application (myapp.ear) which has 3
    components,
    2 webapp comp and an ejb component.
    I have the Myapp.ear file in <weblogic home>/config/baiju/application
    directory
    and the components are listed in the config.xml file as follows :
    <Application Deployed="true" Name="Baiju-WebLogic"
    Path=".\config\mydomain\applications\Baiju-WebLogic.ear">
    <WebAppComponent Name="Baiju-WebLogic-Backoffice"
    Targets="Baiju" URI="Baiju-WebLogic-Backoffice.war"/>
    <EJBComponent Name="Baiju-WebLogic-Ejb"
    Targets="Baiju" URI="Baiju-WebLogic-Ejb.jar"/>
    <WebAppComponent Name="Baiju-WebLogic-Store"
    Targets="Baiju" URI="Baiju-WebLogic-Store.war"/>
    </Application>
    The problem is, when I start the Server it does not deploy theapplication
    "Baiju", if I go to admin console
    I can see the application as deployed ("its checked") and also its 3
    components, but I am not able to access the pages.
    Also this problem is not consistent, it sometimes work, with
    absolutely
    no
    change made to anything, I just re-start the server.
    I have my server running in Production Mode.
    (-Dweblogic.ProductionModeEnabled=true)
    Any help is appreciated,
    Thanks.
    Baiju.

  • Is there any way to reference a component and its properties in a variable ?

    I have two custom components. Only one ever displays depending on the currentState value.
    <componants:wrUnapproved
        itemCreationPolicy="immediate"
        excludeFrom="SQLSERVER"
        id="wrUnapprovedComp"
        wrIdLv="{parentApplication.wrId}"
        userTypeCdLv="{parentApplication.userTypeCd}"
        width="100%"
        height="354"
        y="25"/>
       <componants:wrUnapprovedSqlServer
        itemCreationPolicy="immediate"
        includeIn="SQLSERVER"
        id="wrUnapprovedCompSs"
        wrIdLv="{parentApplication.wrId}"
        userTypeCdLv="{parentApplication.userTypeCd}"
        width="100%"
        height="354"
        y="25"/>
    Now I want to refrence whichever one is active and dynamically reference it
    Like
    myComponanet.init();
    where myComponanet is either wrUnapprovedComp or wrUnapprovedCompSs

    Found my own answer
    var pp:Object = wrUnapprovedComp;  

Maybe you are looking for