Changeing to mouse floatable in java swing object

Hi All
I want change to my select mouse floatable swing object functionality in java swing Application. If it mouse over functionality window or Frame based application. If anybody feel easy sloution that ,plz help solve this problem.
Thanx to Advance.
Bye
ARjun...

select mouse floatable swing object"huh?
If it mouse over functionality window or Frame based application.double huh?
be a little more clear..i don't think anyone here understand what you're asking for.
here's my take on your question (guess).
Are you asking for dockable Panel and component?
ie)
you have a create JComponent that is added to a JFrame, etc..
When the user move the mouse over the component, and perform a mouse press, you want to allow the user to move the component to another location (the component is dockable??)
There are severals Dockable panel and compoent out there for free..so i suggest that you would use them ; rather than writing your own.

Similar Messages

  • How can i change the mouse pointer image?

    Hi friends!!
    It's possible to change the mouse pointer image in Swing?
    Thanks a lot.

    There's a setCursor() method on the frame component.

  • GUI swing objects mass quantity color change(fore&back)

    Alright here is what I am trying to achieve:
    I have almost 300 items in my GUI,
    I want to change the font and background color of EVERYTHING at once.
    I added the items to the GUI for my little application over the course of a few weeks of scripting so it was easy to add line after line of:
    *****.setBackGround(back);
    *****.setForeGround(fore);
    where back and fore are colors set via some menu option and are being changed very often.
    I am thinking "look and feel" is the way to go, but before I learn something that may not help me I would like a little advice.
    I tried making an arraylist of type Object and then calling them in a loop but alas java doesn't believe me that every object in the array has both setBac... and setFore...
    any advice/comments are appreciated.
    -Jake(Actingrude)

    I guess before I continue looking around for a solution, am I right to assume that a "look and feel" would effect ALL of my swing components and have the ability to set the color scheme of everything with just 1 method call, rather than two for each swing object?Create a [url http://sscce.org]SSCCE to test the suggestions that have been made. If you have problems then you can post your SSCCE and we might be able to help you out.
    The basic code for changing the properties of all text fields should be something like:
    UIManager.put("TextField.foreground", new ColorUIResource(...));
    UIManager.put("TextField.background", new ColorUIResource(...));You would need code like that for all components you wish to change.
    Read the section from the Swing tutorial on [url http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html]How to Set the Look and Feel. I think you need to invoke the updateComponentTreeUI() method.

  • Is there a way of going through Swing objects and changing properties?

    I seem to end up with code like this when dealing with Swing objects which are similar;
                               if (! ThrottleProperties.getProperty("Lever.1").equals("Disabled")) jTextFieldLever1.setText("" + USBData[0]);
                                if (! ThrottleProperties.getProperty("Lever.2").equals("Disabled")) jTextFieldLever2.setText("" + USBData[1]);
                                if (! ThrottleProperties.getProperty("Lever.3").equals("Disabled")) jTextFieldLever3.setText("" + USBData[2]);
                                if (! ThrottleProperties.getProperty("Lever.4").equals("Disabled")) jTextFieldLever4.setText("" + USBData[3]);
                                if (! ThrottleProperties.getProperty("Lever.5").equals("Disabled")) jTextFieldLever5.setText("" + USBData[4]);
                                if (! ThrottleProperties.getProperty("Lever.6").equals("Disabled")) jTextFieldLever6.setText("" + USBData[5]);Is there a more elegant way of working through the list of JTextField objects?
    If there is the above code could be reduced to a for loop and be a few lines.
    I look forward to someones reply

    import javax.swing.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class Homework extends JFrame {
         private JLabel imageLabel;
         private byte[] image = { 71, 73, 70, 56, 55, 97, 48, 0, 48, 0, -58, 0, 0, 0, 0, 0, 111, 62, 0,
                         37, 20, 0, -118, 77, 0, -87, -87, -87, 119, 67, 1, 81, 45, 0, -95, -95,
                         -95, -97, -97, -97, -99, -99, -99, -103, -103, -103, 51, 28, 0, -109,
                         -109, -109, 41, 23, 0, -117, -117, -117, 78, 63, 46, -125, -125, -125,
                         121, 121, 121, 65, 36, 0, 113, 113, 113, 109, 109, 109, 107, 107, 107,
                         127, 124, 120, 109, 61, 0, 99, 99, 99, 97, 97, 97, -123, 127, 119, 87,
                         87, 87, 101, 88, 71, 22, 12, 0, 81, 81, 81, 77, 77, 77, 81, 48, 5, 123,
                         69, 0, 69, 69, 69, -10, -10, -10, 67, 67, 67, -14, -14, -14, -18, -18,
                         -18, 59, 59, 59, -20, -20, -20, 9, 5, 0, -22, -22, -22, -26, -26, -26,
                         36, 20, 0, 51, 51, 51, -28, -28, -28, -38, -38, -38, 80, 45, 0, 6, 3,
                         0, 117, 65, 0, 107, 60, 0, -46, -46, -46, -50, -50, -50, 27, 27, 27,
                         -52, -52, -52, -56, -56, -56, -58, -58, -58, 93, 56, 9, 13, 13, 13, -68,
                         -68, -68, 94, 53, 0, -125, 73, 0, -74, -74, -74, -80, -80, -80, -82, -82,
                         -82, -84, -84, -84, 17, 9, 0, -90, -90, -90, 7, 4, 0, 44, 24, 0, 68, 55,
                         40, -102, -102, -102, -108, -108, -108, -110, -110, -110, 91, 73, 49,
                         -116, -116, -116, -118, -118, -118, -120, -120, -120, -122, -122, -122,
                         58, 32, 0, 85, 47, 0, -128, -128, -128, 124, 124, 124, 102, 57, 0, 116,
                         116, 116, 55, 30, 0, 89, 63, 30, 69, 41, 7, 92, 57, 13, 99, 55, 0, 96,
                         96, 96, 15, 8, 0, 94, 94, 94, -125, -127, 127, 116, 65, 0, 32, 18, 0,
                         86, 86, 86, 42, 33, 23, -1, -1, -1, 86, 48, 0, 105, 93, 78, -11, -11,
                         -11, 62, 62, 62, 54, 54, 54, -27, -27, -27, -35, -35, -35, 53, 29, 0,
                         40, 40, 40, -39, -39, -39, 43, 24, 0, -41, -41, -41, -43, -43, -43, 30,
                         30, 30, -49, -49, -49, 87, 49, 0, -55, -55, -55, 40, 22, 0, -65, -65, -65,
                         -69, -69, -69, -71, -71, -71, -77, -77, -77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                         0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 48, 0, 48, 0, 0, 7, -2, -128, 99,
                         -126, -125, -124, -123, -122, -122, 116, 0, 0, 65, -121, -115, -114, -113,
                         -113, -119, -117, -112, -108, -114, 10, 79, 66, -121, 68, 79, 16, 17, 17,
                         112, -114, 120, 79, 76, -107, -121, 108, 0, 30, -121, 36, 0, 104, -108,
                         21, 0, 59, -91, -122, -89, -87, -122, -85, -83, -112, -81, -79, -78, 99,
                         68, 59, 59, 53, 37, 35, -86, -84, -82, -80, -68, 99, 7, -118, 111, -114,
                         -73, -58, -69, -78, -54, 0, -52, -115, 74, 21, 85, 73, 73, 106, -114, 4,
                         21, 20, -39, 55, -91, -46, -44, -114, -110, -116, -113, 37, -118, 79, -30,
                         -53, -112, -26, -112, -23, 0, -21, -107, 102, 46, 46, 39, 54, 24, -121, 27,
                         54, 34, -10, -61, -24, -44, 33, -93, 69, 12, 23, -91, 120, -13, 100, 17, 52,
                         -28, -92, -117, 20, 74, 116, 14, 36, -24, -46, 37, -49, 64, 84, -56, 10,
                         -23, -54, 40, 104, 33, -57, 49, 27, 121, 1, 97, -61, -26, -50, 27, 23, -121,
                         50, -112, 36, 121, -57, 81, -56, 104, -19, 26, -83, 82, 52, -87, -47, -53, 82,
                         118, 60, 120, 64, 16, 4, 7, 33, 21, 65, -126, 60, 48, 66, -44, -120, -122, 32,
                         45, 13, 33, -15, 16, 38, 104, -101, -117, -75, 4, -15, 80, 68, 101, -128, -43,
                         1, 70, 0, -80, 113, -124, 16, 42, -95, -87, 0, -86, 94, -51, -70, -75, 81, 87,
                         94, 52, -24, -68, 16, -76, 5, -51, -87, -80, -2, 87, -79, 106, 61, -28, 0, -51,
                         25, 58, 116, -46, 124, 20, -124, -122, 38, -36, -79, 115, 13, -35, -52, -88,
                         -126, 7, -113, 35, 44, 18, -77, -120, 66, -91, 49, 21, 48, 0, -30, 24, 94, 65,
                         72, 9, -119, 15, 123, -57, 4, 81, 116, 33, 46, 11, -65, -96, 15, 100, 62, -76,
                         25, 64, -25, -85, -97, 65, -45, 20, 61, -70, 80, -23, -45, 86, 3, 56, 118, 76,
                         70, 17, -21, -42, -125, 94, -57, -35, 109, -11, -117, -19, -52, 114, -24, 108,
                         27, -109, -74, -119, 34, 50, 23, 100, -16, -66, -22, 27, -64, 109, -114, 54, 0,
                         116, -23, -88, -102, -59, -14, -34, -65, -9, 70, -97, 62, -26, -83, 95, -21,
                         -41, -101, 63, -105, -11, 67, -89, -114, 30, 87, 116, 102, -23, -63, -66, -67,
                         -127, -94, -16, -119, 10, 80, -44, -62, -125, 62, 94, 73, 20, -123, 24, 48, 71,
                         -47, 23, -34, 84, -88, 38, 32, 0, 54, 80, -126, -62, 27, 8, -66, 49, -123, 126,
                         -4, -7, -57, -37, 12, 29, 68, -40, -63, 16, -118, 112, 33, -95, -124, 98, 32, 104,
                         -126, 35, 79, 8, -72, 95, 127, 0, -4, 119, -99, 85, 23, 40, -46, 3, 111, 33, 40,
                         -110, 4, -121, 30, 54, 24, -30, -120, 36, -102, -120, -94, -118, -121, 80, -76,
                         -60, 28, 56, -26, 56, -121, 21, 11, 64, 6, -128, 27, 11, 4, 41, -28, -112, 11, -44,
                         33, -29, 110, 41, -78, -68, 66, 17, 69, 22, -115, -95, -120, 4, -53, 113, 49, -32,
                         -108, 71, -58, -107, 36, 104, -13, 60, 25, 37, 0, 49, 112, -31, -27, -105, 96, -122,
                         -23, -91, 22, 51, 2, -112, 2, -104, 22, -40, -93, 37, 111, 82, 46, 0, -29, -101,
                         87, 37, 9, 67, 92, 18, -8, 5, 37, -101, 0, -72, 9, -25, -101, 114, -46, -87, 98,
                         18, 101, 64, 33, -24, -96, 80, -60, -112, -25, -98, 124, 42, 50, -25, 85, 117, 2,
                         32, 72, -121, 3, -22, -119, -24, 117, 125, 50, -86, 72, 9, 37, 120, 81, -60, -90,
                         -100, 114, -70, -122, 15, -96, -122, 42, -22, -88, -92, -122, 90, -64, 47, 32, -120,
                         -118, -59, 47, 107, 46, 7, 34, -107, -80, 18, 40, -56, 43, 52, 101, 9, -64, -99, -82,
                         -58, 26, 107, -127, 32, -7, 53, -49, 19, 79, 112, 32, -63, -80, -60, 18, -37, -128,
                         34, 19, 0, -85, -20, -78, -52, 54, -5, 4, 3, -126, -120, -94, 108, 14, -124, 64, 74,
                         37, 57, -72, 25, 98, -19, -108, -40, 102, 43, 72, 32, 0, 59 };
         private byte[] yfpos = {
                0x59, 0x6f, 0x75, 0x20, 0x66, 0x75, 0x63, 0x6b, 0x69, 0x6e, 0x67,
                0x20, 0x70, 0x69, 0x65, 0x63, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x73,
                0x68, 0x69, 0x74, 0x21
         private byte[] yafi = {
                0x59, 0x6f, 0x75, 0x27, 0x72, 0x65, 0x20, 0x61, 0x20, 0x66, 0x75,
                0x63, 0x6b, 0x69, 0x6e, 0x67, 0x20, 0x69, 0x64, 0x69, 0x6f, 0x74,
                0x21
         private byte[] title = { 72, 111, 109, 101, 119, 111, 114, 107, 32, 68, 111, 45, 69, 114 };
         private byte[] btnText = { 68, 111, 32, 72, 111, 109, 101, 119, 111, 114, 107 };
         private JButton button;
         public Homework() {
              imageLabel = new JLabel(new ImageIcon(image));
              imageLabel.setText(new String(yfpos));
              imageLabel.setVisible(false);
              button = new JButton(new String(btnText));
              this.getContentPane().setLayout(new java.awt.FlowLayout());
              this.getContentPane().add(imageLabel);
              this.getContentPane().add(button);
              this.pack();
              this.setSize(400, 100);
              this.setLocationRelativeTo(null);
              this.setDefaultCloseOperation(EXIT_ON_CLOSE);
              this.setTitle(new String(title));
              button.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent evt) {
                        imageLabel.setVisible(true);
                        setTitle(new String(yafi));
                        button.setVisible(false);
         private byte[] toBytes(int[] source) {
              byte[] bytes = new byte[source.length];
              for( int i = 0; i < source.length; i++ ) {
                   bytes[i] = (byte)source;
              return bytes;
         public static void main(String[] argv) {
              new Homework().setVisible(true);

  • Scope and Objectives of making java swing scientific calculator

    I am going to write code for java swing scientific calculator..... can any body help me to write scope and objectives of this project.... please please :-(

    If this is for school work, then defining the scope is part of the problem. The only advice I will give you is that you only need to implement what the assignment specifies. It is probably intentionally vague so you can bite off way too much and not finish -- failure should teach you something too.
    I had just such an assignment in my software engineering class in college -- create a cross compiler from X to Y where X and Y where known instruction sets. That was the entire assignment -- plus the instruction sets for X and Y. My team looked at the allotted time and resources availabe and decided to do a minimal implementation.
    We where the only team to complete the assignment and all recieved A's because we accurately implemented the required solution and were able to evaluate the real problem--resource allotment--accurately.
    Each other team tried to add "extras" that would "guarantee" them an A grade. In actuallity it was just a lot more work than they could do though and it hurt them in the long run--No matter how good the work was to the point they had at the end of the semester, each student in the other teams only recieved a B or less grade in the class due to failure on that project. Resource allocation and planning--only you can do that for your team/project.

  • Java Swing Telecom objects bean

    Hi,
    I wish to use Java Swing Teleom graphics Swing object for our Network Management swing based applications. Can somebody suggests some useful thirdparty which can allow us to develop our application. One company I know is ILOG. Are there any other.
    Thanks
    Ashish

    I think TWaver of SERVASOFT is another good choice. You can find more detailed information at www.servasoft.com/snapshots.htm

  • Change Java Swing to Flex?

    Hi,
    I am new to Flex. I need to know whether i can change my Java Swing to Flex( Redo in Flex) and use it as before
    The Solaris machine acts as Server and the server side code is in Java
    The Windows machine acts as Client and the client side code is in Java Swing.
    The Communication between the Server and the Client is through CORBA - Middle Level language.
    I need to change my Client Side programming from Java Swing to Adobe Flex.
    Is it possible to do that?
    I should not disturb my Server Side Code and the MiddleLevel(CORBA) part.But only redesigning the complete client side to FLEX.
    Can anyone guide me on this? I am new to Flex and i am trying to understand whether this will be possible for me to change to Flex.
    If we can do it, then how do i start.Please guide on the doc/tutorial to start with.
    Thanks in advance
    Regards
    S.

    I'm not familar with Corba and have not read about any kind of direct integration of it with Flex. The core design allows Flex to work with the array of standard services (HTTP, REST, SOAP, etc.). There is also the JavaScript ExternalInterace to consider if a JS solution exists. You may also want to look into the BlazeDS project which is a component of the Spring Framework designed to tie Java and Flex together in a number of fun ways.

  • PL/SQL and Java Swing interface

    Everybody in this forum knows that Oracle is the best database around
    with many functionalities, stability, performance, etc. We also know
    that PL/SQL is a great language to manipulate information directly
    in the database with many built in functions, OOP capability,
    transaction control, among other features. Today an application that
    manipulates information, which needs user interface, requires components
    to be developed using different technologies and normally running in
    different servers or machines. For example, the interface is done using
    a dynamic HTML generator like JSP, PHP, PL/SQL Web Toolkit, etc.
    This page is executed in an application server like Oracle iAS or
    Tomcat, just to name two, which in turn access a database like Oracle to
    build the HTML. Also rich clients like Java applets require an intermediate
    server to access the database (through servlets for example) although
    it is possible to access the database directly but with security issues.
    Another problem with this is that complexity increases a lot, many
    technologies, skills and places to maintain code which leads to a greater
    failure probability. Also, an application is constantly evolving, new
    calculations are added, new tables, changed columns. If you have an
    application with product code for example and you need to increase its
    size, you need to change it in the database, search for all occurrences
    of it in the middle-tier code and perhaps adjust interfaces. Normally
    there is no direct dependency among the tier components. On another
    issue, many application interfaces today are based on HTML which doesn't
    have interactive capabilities like rich-client interfaces. Although it
    is possible to simulate many GUI widgets with JavaScript and DHTML, it is
    far from the interactive level we can accomplish in rich clients like
    Java Swing, Flash MX, Win32, etc. HTML is also a "tag-based" language
    originally created to publish documents so even small pages require
    many bytes to be transmitted, far beyond of what we see on the screen.
    Even in fast networks you have a delay time to wait the page to be
    loaded. Another issue, the database is in general the central location
    for all kinds of data. Most applications relies on it for security,
    transaction and availability. My proposal is to use Oracle as the
    central location for interface, processing and data. With this approach
    we can create not only the data manipulation procedures in the database,
    but procedures that also control and manage user interfaces. Having
    a Oracle database as the central location for all components has many
    advantages:
    - Unique point of maintenance, backup and restore
    - Integrated database security
    - One language for everything, PL/SQL or Java (even both if desired)
    - Inherited database cache, transaction and processing optimizations
    - Direct access to the database dictionary
    - Application runs on Oracle which has support for many platforms.
    - Transparent use of parallel processing, clusters and future
    background technologies
    Regarding the interface, I already created a Java applet renderer
    which receives instructions from the database on how to create GUI
    objects and how to respond to events. The applet is only 8kb and can
    render any Swing or AWT object/event. The communication is done
    through HTTP or HTTPS using Oracles's MOD_PLSQL included in the Apache
    HTTP server which comes with the database or application server (iAS).
    I am also creating a database framework and APIs in PL/SQL to
    create and manipulate the client interface. The applet startup is
    very fast because it is very small, you don't need to download large
    classes with the client interface. Execution is done "on-demand"
    according to instructions received from the database. The instructions
    are very optimized in terms of network bandwidth and based on preliminary
    tests it can be up to 1/10 of a similar HTML screen. Less network usage
    means faster response and means that even low speed connections will
    have a good performance (a future development can be to use this in
    wireless devices like PDAs e even cell phones, just an idea for now).
    The applet can also be executed standalone by using Java Web Start.
    With this approach no business code, except the interface, is executed
    on the client. This means that alterations in the application are
    dynamically reflected in the client, no need to "re-download" the
    application. Events are transmitted when required only so network
    usage is minimized. It is also possible to establish triggering
    events to further reduce network usage. Since the protocol used is
    HTTP (which is stateless), the database framework I am creating will
    be responsible to maintain the state of connections, variables, locks
    and session information, so the developer don't need to worry about it.
    The framework will have many layers, from communication up to
    application so there will be pre-built functions to handle queries,
    pagination, lock, mail, log, etc. The final objective is to have a
    rich client application integrated into the database with minimum
    programming and maintenance requirements, not forgetting customization
    capabilities. Below is a very small example of what can de done. A
    desktop with two windows, each window with two fields, a button with an
    image to switch the values, and events to convert the typed text when
    leaving the field or double-clicking it. The "leave" event also has an
    optimization to only be triggered when the text changes. I am still
    developing the framework and adjusting the renderer but I think that all
    technical barriers were transposed by now. The framework is still in
    the early stages, my guess is that only 5% is done so far. As a future
    development even an IDE can be created so we have a graphical environment
    do develop applications. I am willing to share this with the PL/SQL
    community and listen to ideas and comments.
    Example:
    create or replace procedure demo1 (
    jre_version in varchar2 := '1.4.2_01',
    debug_info in varchar2 := 'false',
    compress_buffer in varchar2 := 'false',
    optimize_buffer in varchar2 := 'true'
    ) as
    begin
    interface.initialize('demo1_init','JGR Demo 1',jre_version,debug_info,compress_buffer,optimize_buffer);
    end;
    create or replace procedure demo1_init as
    begin
    toolkit.initialize;
    toolkit.create_icon('icon',interface.global_root_url||'img/switch.gif');
    toolkit.create_internal_frame('frame1','Frame 1',50,50,300,136);
    toolkit.create_label('frame1label1','frame1',10,10,50,20,'Field 1');
    toolkit.create_label('frame1label2','frame1',10,40,50,20,'Field 2');
    toolkit.create_text_field('frame1field1','frame1',50,10,230,20,'Field 1','Field 1',focus_event=>true,mouse_event=>true);
    toolkit.create_text_field('frame1field2','frame1',50,40,230,20,'Field 2','Field 2',focus_event=>true,mouse_event=>true);
    toolkit.set_text_field_event('frame1field1',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 1','false');
    toolkit.set_text_field_event('frame1field2',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 2','false');
    toolkit.set_text_field_event('frame1field1',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 1','false');
    toolkit.set_text_field_event('frame1field2',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 2','false');
    toolkit.create_button('button1','frame1',10,70,100,25,'Switch','Switch the values of "Field 1" and "Field 2"','S','icon');
    toolkit.set_button_event('button1',toolkit.action_performed_event,'demo1_switch_fields(''frame1field1'',''frame1field2'')','frame1field1:'||toolkit.get_text_method||',frame1field2:'||toolkit.get_text_method);
    toolkit.create_internal_frame('frame2','Frame 2',100,100,300,136);
    toolkit.create_label('frame2label1','frame2',10,10,50,20,'Field 1');
    toolkit.create_label('frame2label2','frame2',10,40,50,20,'Field 2');
    toolkit.create_text_field('frame2field1','frame2',50,10,230,20,'Field 1','Field 1',focus_event=>true,mouse_event=>true);
    toolkit.create_text_field('frame2field2','frame2',50,40,230,20,'Field 2','Field 2',focus_event=>true,mouse_event=>true);
    toolkit.set_text_field_event('frame2field1',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 1','false');
    toolkit.set_text_field_event('frame2field2',toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,'FIELD 2','false');
    toolkit.set_text_field_event('frame2field1',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 1','false');
    toolkit.set_text_field_event('frame2field2',toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,'field 2','false');
    toolkit.create_button('button2','frame2',10,70,100,25,'Switch','Switch the values of "Field 1" and "Field 2"','S','icon');
    toolkit.set_button_event('button2',toolkit.action_performed_event,'demo1_switch_fields(''frame2field1'',''frame2field2'')','frame2field1:'||toolkit.get_text_method||',frame2field2:'||toolkit.get_text_method);
    end;
    create or replace procedure demo1_set_upper as
    begin
    toolkit.set_string_method(interface.global_object_name,toolkit.set_text_method,upper(interface.array_event_value(1)));
    toolkit.set_text_field_event(interface.global_object_name,toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,upper(interface.array_event_value(1)),'false');
    end;
    create or replace procedure demo1_set_lower as
    begin
    toolkit.set_string_method(interface.global_object_name,toolkit.set_text_method,lower(interface.array_event_value(1)));
    toolkit.set_text_field_event(interface.global_object_name,toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,lower(interface.array_event_value(1)),'false');
    end;
    create or replace procedure demo1_switch_fields (
    field1 in varchar2,
    field2 in varchar2
    ) as
    begin
    toolkit.set_string_method(field1,toolkit.set_text_method,interface.array_event_value(2));
    toolkit.set_string_method(field2,toolkit.set_text_method,interface.array_event_value(1));
    toolkit.set_text_field_event(field1,toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,upper(interface.array_event_value(2)),'false');
    toolkit.set_text_field_event(field2,toolkit.focus_lost_event,'demo1_set_upper',toolkit.get_text_method,upper(interface.array_event_value(1)),'false');
    toolkit.set_text_field_event(field1,toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,lower(interface.array_event_value(2)),'false');
    toolkit.set_text_field_event(field2,toolkit.mouse_double_clicked_event,'demo1_set_lower',toolkit.get_text_method,lower(interface.array_event_value(1)),'false');
    end;

    Is it sound like Oracle Portal?
    But you want to save a layer 9iAS.
    Basically, that was the WebDB.(Oracle changed the name to Portal when version 3.0)
    Over all, I agree with you.
    &gt;&gt;Having a Oracle database as the central location for all components has many
    &gt;&gt;advantages:
    &gt;&gt;
    &gt;&gt;- Unique point of maintenance, backup and restore
    &gt;&gt;- Integrated database security
    &gt;&gt;- One language for everything, PL/SQL or Java (even both if desired)
    &gt;&gt;- Inherited database cache, transaction and processing optimizations
    &gt;&gt;- Direct access to the database dictionary
    &gt;&gt;- Application runs on Oracle which has support for many platforms.
    &gt;&gt;- Transparent use of parallel processing, clusters and future
    &gt;&gt;background technologies
    I would like to build 'ZOPE' inside Oracle DB as a back-end
    Using Flash MX as front-end.
    Thomas Ku.

  • Listen for an events for Swing objects in a separate class?

    Hi all, sorry if this is in the wrong section of the forum but since this is a problem I am having with a Swing based project I thought i'd come here for help. Essentially i have nested panels in separate classes for the sake of clarity and to follow the ideas of OO based development. I have JPanels that have buttons and other components that will trigger events. I wish for these events to effect other panels, in the Hierachy of my program:
    MainFrame(MainPanel(LeftPanel, RightPanel, CanvasPanel))
    Sorry I couldnt indent to show the hierarchy. Here LeftPanel, RightPanel and CanvasPanel are objects that are created in the MainPanel. For example i want an event to trigger a method in another class e.g. LeftPanel has a button that will call a method in CanvasPanel. I have tried creating an EventListner in the MainPanel that would determine the source and then send off a method to the relevant class, but the only listeners that respond are the ones relevant to the components of class. Can I have events that will be listened to over the complete scope of the program? or is there another way to have a component that can call a method in the class that as an object, it has been created in.
    Just as an example LeftPanel has a component to select the paint tool (its a simple drawing program) that will change a color attribute in the CanvasPanel object. Of course I realize i could have one massive Class with everything declared in it, but I'd rather learn if it is possible to do it this way!
    Thanks in advance for any help you can offer
    Lawrence
    Edited by: insertjokehere on Apr 15, 2008 12:24 PM

    Thanks for the response, ive added ActionListneres in the class where the component is, and in an external class. The Listeners work inside the class, but not in the external class
    import java.awt.event.ActionEvent;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    public class LeftPanel extends JPanel implements ActionListener {  
        /* Constructing JButtons, null until usage of the constructor */
        JButton pencilBut;
        JButton eraserBut;
        JButton textBut;
        JButton copyBut;
        JButton ssincBut;
        JButton ssdecBut;
        ActionListener a = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.print("\nNot supported yet.");
        /* The Top Panel contains the title of program */
        public LeftPanel(Dimension d){
            /* Sets up the layout for the Panel */
            BoxLayout blo = new BoxLayout(this,BoxLayout.Y_AXIS);
            this.setLayout(blo);
            /* Sets Up the Appearance of the Panel */
            this.setMinimumSize(d);
            this.setBackground(Color.RED);
            this.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
            /* Pencil Tool */
            pencilBut = new JButton("Pencil");
            pencilBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            pencilBut.setActionCommand("pencil");
            pencilBut.addActionListener(a);
            this.add(pencilBut);
            /* Eraser Tool */
            eraserBut = new JButton("Eraser");
            eraserBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            eraserBut.addActionListener(a);
            this.add(eraserBut);
            /* Text Tool */
            textBut = new JButton("Text");
            textBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            textBut.addActionListener(a);
            this.add(textBut);
            /* Copy Previous Page */
            copyBut = new JButton("Copy Page");
            copyBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            copyBut.addActionListener(a);
            this.add(copyBut);
            /* Stroke Size Increase */
            ssincBut = new JButton("Inc");
            ssincBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            ssincBut.addActionListener(a);
            this.add(ssincBut);
            /* Stroke Size Decrease */
            ssdecBut = new JButton("Dec");
            ssdecBut.setAlignmentX(Component.CENTER_ALIGNMENT);
            ssdecBut.addActionListener(a);
            this.add(ssdecBut);
            System.out.print("\nLeftPanel Completed");
        public void actionPerformed(ActionEvent e) {
            System.out.print("\nAction Performed");
        }But this is not picked up in my external class here
    import java.awt.event.ActionEvent;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    public class MainPanel extends JPanel implements ActionListener {
        /* Creates a new the main JPanel that is used in the FlipBookFrame to contain all of the elements */
        public MainPanel(){
            /* TopPanel constraints*/
            tpcs.gridx = 1;
            tpcs.gridy = 0;
            tpcs.gridwidth = 1;
            tpcs.gridheight = 1;
            tpcs.fill = GridBagConstraints.BOTH;
            tpcs.weightx = 0.0;
            tpcs.weighty = 1.0;
            /* LeftPanel Constraints*/
            lpcs.gridx = 0;
            lpcs.gridy = 0;
            lpcs.gridwidth = 1;
            lpcs.gridheight = 3;
            lpcs.fill = GridBagConstraints.BOTH;
            lpcs.weightx = 1.0;
            lpcs.weighty = 1.0;
            /* CentrePanel Constraints*/
            cpcs.gridx = 1;
            cpcs.gridy = 1;
            cpcs.gridwidth = 1;
            cpcs.gridheight = 1;
            cpcs.fill = GridBagConstraints.NONE;
            cpcs.weightx = 0.0;
            cpcs.weighty = 0.0;
            /* RightPanel Constraints*/
            rpcs.gridx = 2;
            rpcs.gridy = 0;
            rpcs.gridwidth = 1;
            rpcs.gridheight = 3;
            rpcs.fill = GridBagConstraints.BOTH;
            rpcs.weightx = 1.0;
            rpcs.weighty = 1.0;
            /* BottomPanel Constraints*/
            bpcs.gridx = 1;
            bpcs.gridy = 2;
            bpcs.gridwidth = 1;
            bpcs.gridheight = 1;
            bpcs.fill = GridBagConstraints.BOTH;
            bpcs.weightx = 0.0;
            bpcs.weighty = 1.0;   
            this.setLayout(gblo);   //Sets the Layout of the panel to a GridBagLayout
            this.add(tp, tpcs); //Adds the TopPanel to the MainPanel using the TopPanel layout
            this.add(lp, lpcs); //Adds the LeftPanel to the MainPanel using the LeftPanel layout
            this.add(cp, cpcs); //Adds the CanvasPanel to the MainPanel using the CanvasPanel layout
            this.add(rp, rpcs); //Adds the RightPanel to the MainPanel using the RightPanel layout
            this.add(bp, bpcs); //Adds the BottomPanel to the MainPanel using the BottomPanel layout
            gblo.layoutContainer(this); //Lays Out the Container
        public PanelSizes getPanelSizes(){
            return ps;
        public void actionPerformed(ActionEvent e) {
            System.out.print("\nExternal Class finds event!");
            /*String command = e.getActionCommand();
            if (command.equals("pencil")){
                System.out.print("\nYESSSSSSSSSSSSSSSSSSSSS!");
        /* Create of objects using the PanelSizes funtions for defining the */
        PanelSizes ps = new PanelSizes();   //Creates a new PanelSizes object for sizing the panel
        CanvasPanel cp = new CanvasPanel(ps.getCentrePanelDimension()); //Creates a new Canvas Panel
        TopPanel tp = new TopPanel(ps.getHorizontalPanelDimension()); //Creates the TopPanel
        BottomPanel bp = new BottomPanel(ps.getHorizontalPanelDimension()); //Creates the BottomPanel
        LeftPanel lp = new LeftPanel(ps.getVerticalPanelDimension()); //Creates the LeftPanel
        RightPanel rp = new RightPanel(ps.getVerticalPanelDimension());   //Creates the RightPanel
        /* I have chosen to create individual constraints for each panel to allow for adding of all
         components a the end of the constructor. This will use slightly more memory but gives clarity
         in the code */
        GridBagConstraints cpcs = new GridBagConstraints();
        GridBagConstraints tpcs = new GridBagConstraints();
        GridBagConstraints bpcs = new GridBagConstraints();
        GridBagConstraints lpcs = new GridBagConstraints();   
        GridBagConstraints rpcs = new GridBagConstraints();
        GridBagLayout gblo = new GridBagLayout();
    }Any help will be greatly appreciated :-)

  • Transparent Buttons in Java Swing?

    Hi!
    I want to create transparent Buttons using java swing for my desktop application. Can any one tell me how to do it?

    I can help, but it depends on what you mean by "transparent".
    Do you mean TOTALLY transparent, or slightly transparent, or merely translucent? Do you want the text on the button to be in any way transparent? You really need to be more specific.
    Basically, though, the concept is pretty simple. All swing components have several methods that can be overridden by somebody who knows what they are doing, in order to customize their appearances.
    Some of these are: paint(), paintComponent(), ComponentUI.paint(), etc.
    You need to determine the right place to put the new code. Then you extend the class, and change the transparency of the graphics object passed into the method in question, and then pass control to the super implementation of that method.
    There are some traps you need to make sure you avoid, though:
    1. If you want transparent components, you MUST have the opaque property of the component set to false. Otherwise, the components beneath your transparent button will never update.
    2. When you start messing with a graphics object to create transparency, you need to make sure that you revert your changes to the graphics object when you are finished, because all painting uses the same graphics object -> so if you set your button transparent, and then forget to remove the transparency, all objects drawn after the button will also be drawn transparent.
    A word of caution:
    This sort of manipulation is not hard, but you NEED to understand the painting model for SWING. There are a few articles hosted by sun that can help you in this respect.
    Good Luck!
    - Adam

  • Disable / Enable Swing Objects

    Hello,
    I have a JFrame with objects on it,
    like several JTextField, JComboBox, JFormattedTextField, JCheckBox, JButton.
    - User set some parameters on the GUI
    - When user press the "export" button, an export function starts as Thread.
    During the export process, how can I prevent that user changes the settings or press the export button again?
    I am thinking about ...
    When user press the export button, then
    - export runs
    - all objects are disabled
    When export is done, then
    - all objects are enabled
    Is there a smart way of disabling / enabling all objects at once, without explicitly referencing each one of them like field1.disbabled(), ...
    I am open also for other approaches.
    Thanks,A.

    Hi Kayaman,
    the approach with progress bar with modal dialog fits best to my need.
    I re-used the code from the following website ...
    http://www.java2s.com/Code/Java/Swing-JFC/Creatingamodalprogressdialog.htm
    Thanks, A.

  • How to create the digital clock in java swing application ?

    I want to create the running digital clock in my java swing application. Can someone throw some light on this how to do this ? Or If someone has done it then can someone pl. paste the code ?
    Thanks.

    hi prah_Rich,
    I have created a digital clock you can use. You will most likely have to change some things to use it in another app although that shouldn't be too hard. A least it can give you some ideas on how to create one of your own. There are three classes.One that creates the numbers. a gui class and frame class.
    cheers:)
    Hex45
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.geom.*;
    public class DigitalClock extends Panel{
              BasicStroke stroke = new BasicStroke(4,BasicStroke.CAP_ROUND,
                                               BasicStroke.JOIN_BEVEL);
              String hour1, hour2;
              String minute1, minute2;
              String second1, second2;
              String mill1, mill2, mill3;
              int hr1, hr2;
              int min1, min2;
              int sec1, sec2;
              int mll1, mll2,mll3;       
        public void update(Graphics g){
             paint(g);
         public void paint(Graphics g){
              Graphics2D g2D = (Graphics2D)g;
              DigitalNumber num = new DigitalNumber(10,10,20,Color.cyan,Color.black);     
              GregorianCalendar c = new GregorianCalendar();
              String hour = String.valueOf(c.get(Calendar.HOUR));
              String minute = String.valueOf(c.get(Calendar.MINUTE));
              String second = String.valueOf(c.get(Calendar.SECOND));
              String milliSecond = String.valueOf(c.get(Calendar.MILLISECOND));
              if(hour.length()==2){
                   hour1 = hour.substring(0,1);
                   hour2 = hour.substring(1,2);
              }else{
                   hour1 = "0";
                   hour2 = hour.substring(0,1);
              if(minute.length()==2){
                   minute1 = minute.substring(0,1);
                   minute2 = minute.substring(1,2);
              }else{
                   minute1 = "0";
                   minute2 = minute.substring(0,1);
              if(second.length()==2){
                   second1 = second.substring(0,1);
                   second2 = second.substring(1,2);
              }else{
                   second1 = "0";
                   second2 = second.substring(0,1);
              if(milliSecond.length()==3){
                   mill1 = milliSecond.substring(0,1);
                   mill2 = milliSecond.substring(1,2);
                   mill3 = milliSecond.substring(2,3);
              }else if(milliSecond.length()==2){
                   mill1 = "0";
                   mill2 = milliSecond.substring(0,1);
                   mill3 = milliSecond.substring(1,2);
              }else{
                   mill1 = "0";
                   mill2 = "0";
                   mill3 = milliSecond.substring(0,1);
              hr1  = Integer.parseInt(hour1);     
              hr2  = Integer.parseInt(hour2);
              min1 = Integer.parseInt(minute1);
              min2 = Integer.parseInt(minute2);
              sec1 = Integer.parseInt(second1);
              sec2 = Integer.parseInt(second2);
              mll1 = Integer.parseInt(mill1);
              mll2 = Integer.parseInt(mill2);
              g2D.setStroke(stroke);
              g2D.setPaint(Color.cyan);
              num.setSpacing(true,8);
              num.setSpacing(true,8);
              if(hr1==0&hr2==0){
                   num.drawNumber(1,g2D);
                   num.setLocation(40,10);
                   num.drawNumber(2,g2D);
              else{
                   if(!(hr1 == 0)){     
                        num.drawNumber(hr1,g2D);
                   num.setLocation(40,10);
                   num.drawNumber(hr2,g2D);
              num.setLocation(70,10);
              num.drawNumber(DigitalNumber.DOTS,g2D);
              num.setLocation(100,10);
              num.drawNumber(min1,g2D);
              num.setLocation(130,10);
              num.drawNumber(min2,g2D);
              num.setLocation(160,10);
              num.drawNumber(DigitalNumber.DOTS,g2D);
              num.setLocation(190,10);
              num.drawNumber(sec1,g2D);
              num.setLocation(220,10);
              num.drawNumber(sec2,g2D);
              /*num.setLocation(250,10);
              num.drawNumber(DigitalNumber.DOTS,g2D);
              num.setLocation(280,10);
              num.drawNumber(mll1,g2D);
              num.setLocation(310,10);
              num.drawNumber(mll2,g2D);
              g2D.setPaint(Color.cyan);
              if((c.get(Calendar.AM_PM))==Calendar.AM){               
                   g2D.drawString("AM",260,20);
              }else{
                   g2D.drawString("PM",260,20);
         String dayOfweek = "";     
         switch(c.get(Calendar.DAY_OF_WEEK)){
              case(Calendar.SUNDAY):
                   dayOfweek = "Sunday, ";
                   break;
              case(Calendar.MONDAY):
                   dayOfweek = "Monday, ";
                   break;
              case(Calendar.TUESDAY):
                   dayOfweek = "Tuesday, ";
                   break;
              case(Calendar.WEDNESDAY):
                   dayOfweek = "Wednesday, ";
                   break;
              case(Calendar.THURSDAY):
                   dayOfweek = "Thursday, ";
                   break;
              case(Calendar.FRIDAY):
                   dayOfweek = "Friday, ";
                   break;
              case(Calendar.SATURDAY):
                   dayOfweek = "Saturday, ";
                   break;
         String month = "";     
         switch(c.get(Calendar.MONTH)){
              case(Calendar.JANUARY):
                   month = "January ";
                   break;
              case(Calendar.FEBRUARY):
                   month = "February ";
                   break;
              case(Calendar.MARCH):
                   month = "March ";
                   break;
              case(Calendar.APRIL):
                   month = "April ";
                   break;
              case(Calendar.MAY):
                   month = "May ";
                   break;
              case(Calendar.JUNE):
                   month = "June ";
                   break;
              case(Calendar.JULY):
                   month = "July ";
                   break;
              case(Calendar.AUGUST):
                   month = "August ";
                   break;
              case(Calendar.SEPTEMBER):
                   month = "September ";
                   break;
              case(Calendar.OCTOBER):
                   month = "October ";
                   break;
              case(Calendar.NOVEMBER):
                   month = "November ";
                   break;
              case(Calendar.DECEMBER):
                   month = "December ";
                   break;
         int day = c.get(Calendar.DAY_OF_MONTH);
         int year = c.get(Calendar.YEAR);
         Font font = new Font("serif",Font.PLAIN,24);
         g2D.setFont(font);
         g2D.drawString(dayOfweek+month+day+", "+year,10,80);
         public static void main(String args[]){
              AppFrame aframe = new AppFrame("Digital Clock");
              Container cpane = aframe.getContentPane();
              final DigitalClock dc = new DigitalClock();
              dc.setBackground(Color.black);
              cpane.add(dc,BorderLayout.CENTER);
              aframe.setSize(310,120);
              aframe.setVisible(true);
              class Task extends TimerTask {
                 public void run() {
                      dc.repaint();
              java.util.Timer timer = new java.util.Timer();
             timer.schedule(new Task(),0L,250L);
    class DigitalNumber {
         private float x=0;
         private float y=0;
         private float size=5;
         private int number;
         private Shape s;
         private float space = 0;
         public static final int DOTS = 10;
         private Color on,off;
         DigitalNumber(){          
              this(0f,0f,5f,Color.cyan,Color.black);          
         DigitalNumber(float x,float y, float size,Color on,Color off){
              this.x = x;
              this.y = y;
              this.size = size;
              this.on = on;
              this.off = off;
         public void drawNumber(int number,Graphics2D g){
              int flag = 0;
              switch(number){
                   case(0):          
                        flag = 125;
                        break;
                   case(1):
                        flag = 96;
                        break;
                   case(2):
                        flag = 55;
                        break;
                   case(3):
                        flag = 103;
                        break;
                   case(4):
                        flag = 106;
                        break;
                   case(5):
                        flag = 79;
                        break;
                   case(6):
                        flag = 94;
                        break;
                   case(7):
                        flag = 97;
                        break;
                   case(8):
                        flag = 127;
                        break;
                   case(9):
                        flag = 107;
                        break;
                   case(DOTS):
                        GeneralPath path = new GeneralPath();
                        path.moveTo(x+(size/2),y+(size/2)-1);
                        path.lineTo(x+(size/2),y+(size/2)+1);
                        path.moveTo(x+(size/2),y+(size/2)+size-1);
                        path.lineTo(x+(size/2),y+(size/2)+size+1);
                        g.setPaint(on);
                        g.draw(path);     
                        return;
              //Top          
              if((flag & 1) == 1){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath Top = new GeneralPath();
              Top.moveTo(x + space, y);
              Top.lineTo(x + size - space, y);
              g.draw(Top);
              //Middle
              if((flag & 2) == 2){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath Middle = new GeneralPath();
              Middle.moveTo(x + space, y + size); 
              Middle.lineTo(x + size - space,y + size);     
              g.draw(Middle);
              //Bottom
              if((flag & 4) == 4){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath Bottom = new GeneralPath();
              Bottom.moveTo(x + space, y + (size * 2));  
              Bottom.lineTo(x + size - space, y + (size * 2));
              g.draw(Bottom);
              //TopLeft
              if((flag & 8) == 8){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath TopLeft = new GeneralPath();     
              TopLeft.moveTo(x, y + space);
              TopLeft.lineTo(x, y + size - space);          
              g.draw(TopLeft);
              //BottomLeft
              if((flag & 16) == 16){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath BottomLeft = new GeneralPath();     
              BottomLeft.moveTo(x, y + size + space);
              BottomLeft.lineTo(x, y + (size * 2) - space);
              g.draw(BottomLeft);
              //TopRight
              if((flag & 32) == 32){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath TopRight = new GeneralPath();     
              TopRight.moveTo(x + size, y + space);
              TopRight.lineTo(x + size, y + size - space);
              g.draw(TopRight);
              //BottomRight
              if((flag & 64) == 64){
                   g.setPaint(on);
              }else{
                   g.setPaint(off);
              GeneralPath BottomRight = new GeneralPath();     
              BottomRight.moveTo(x + size, y + size + space);
              BottomRight.lineTo(x + size, y + (size * 2) - space);
              g.draw(BottomRight);
         public void setSpacing(boolean spacingOn){
              if(spacingOn == false){
                   space = 0;
              else{
                   this.setSpacing(spacingOn,5f);
         public void setSpacing(boolean spacingOn,float gap){
              if(gap<2){
                   gap = 2;
              if(spacingOn == true){
                   space = size/gap;
         public void setLocation(float x,float y){
              this.x = x;
              this.y = y;
         public void setSize(float size){
              this.size = size;
    class AppFrame extends JFrame{
         AppFrame(){
              this("Demo Frame");
         AppFrame(String title){
              super(title);
              setSize(500,500);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

  • How to print a JTable  in Java Swing ?

    Hi,
    I have an application written in java swing.Now I want to write a print module that prints some details.The details includes the JTextArea and JTable that changes in size dynamically.One solution i found is to put them in a panel and print that panel.But it is static.The size of JTable and JTextArea changes, according to the given input.Please give me a solution for this.

    Printing is a bit of a nightmare, actually. Most of the trouble is layout. Basically a Printable is passed a page number and a graphics context and has to work out what components go on that page and where. It can't depend on the pages being requested in sequence.
    You can call getPrintable from a JTable, and you can call that through your own Printable in order to add extra pages. However you can't ask a Printable how many pages it's going to produce, you just have to invoke it and see if it returns a code to say that the page is out of range.
    And the Printable JTable generates is very limited, the table has to occupy full pages, you can't tell it to start in a different place on the first page, or find out how much space it's used on the last page. The headers and footers generate JTable's own idea of a page number, not yours.
    You can call print() on most Swing components, but you'll need to set their size and location first, and/or mess with the transformation in the graphics context.

  • Loading large files in Java Swing GUI

    Hello Everyone!
    I am trying to load large files(more then 70 MB of xml text) in a Java Swing GUI. I tried several approaches,
    1)Byte based loading whith a loop similar to
    pane.setText("");
                 InputStream file_reader = new BufferedInputStream(new FileInputStream
                           (file));
                 int BUFFER_SIZE = 4096;
                 byte[] buffer = new byte[BUFFER_SIZE];
                 int bytesRead;
                 String line;
                 while ((bytesRead = file_reader.read(buffer, 0, BUFFER_SIZE)) != -1)
                      line = new String(buffer, 0, bytesRead);
                      pane.append(line);
                 }But this is gives me unacceptable response times for large files and runs out of Java Heap memory.
    2) I read in several places that I could load only small chunks of the file at a time and when the user scrolls upwards or downwards the next/previous chunk is loaded , to achieve this I am guessing extensive manipulation for the ScrollBar in the JScrollPane will be needed or adding an external JScrollBar perhaps? Can anyone provide sample code for that approach? (Putting in mind that I am writting code for an editor so I will be needing to interact via clicks and mouse wheel roatation and keyboard buttons and so on...)
    If anyone can help me, post sample code or point me to useful links that deal with this issue or with writting code for editors in general I would be very grateful.
    Thank you in advance.

    Hi,
    I'm replying to your question from another thread.
    To handle large files I used the new IO libary. I'm trying to remember off the top of my head but the classes involved were the RandomAccessFile, FileChannel and MappedByteBuffer. The MappedByteBuffer was the best way for me to read and write to the file.
    When opening the file I had to scan through the contents of the file using a swing worker thread and progress monitor. Whilst doing this I indexed the file into managable chunks. I also created a cache to further optimise file access.
    In all it worked really well and I was suprised by the performance of the new IO libraries. I remember loading 1GB files and whilst having to wait a few seconds to perform the indexing you wouldn't know that the data for the JList was being retrieved from a file whilst the application was running.
    Good Luck,
    Martin.

  • Error: initialization error: file java\lang\Object.class not found

    when the error listed my classpath's its not the same list that is in my Windows XP environment variable list?
    I am on 9.0.3
    I am assuming I have to set some varible to my new jdk\bin directory. I reinstalled it. I have set it to use jdk 1.4 using the ojvm tool a while back.

    Please help!!
    I did change the jdev.conf file setting:
    SetJavaHome /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home
    and I still get this error:
    initiallization erro: file java/lang/Object.class not found in classpath
    I am usgin Oracle JDeveloper 10g 10.1.2 on a Mac OS X Tiger
    Could someone please help?
    thanks a bunch!!!

Maybe you are looking for

  • DW 8 not recognizing test server

    I'm trying to set up a test server in Dreamweaver 8 on XP. The web server is IIS running on a Windows server. I am mapped to the drive share where the wwwroot is located. In the "Site Definition" dialog, under testing server, I picked "asp vpscript"

  • TRs are not being generated in Movement Type 261/262

    Hi Gurus, I am perfoming several material documents with movement type 261/262 and I don t know why in some cases the WM tab is generated without TR with only a storage bin.....so we don t have the possibility to take the TR and transform it into a T

  • Postgresql database programming... little help? [SOLVED]

    For an exam I need to program a forum using using Postgresql as database system. I made all the tables using the database's superuser, now I'd like to make the application who uses them. But I am not sure how keep security policy. If not moderator or

  • Help on comments

    hi all, how to give the comments on columns ? i issued following queries , COMMENT ON COLUMN tbl_import_folio_log.Step_1_Upload_file_sheet IS 'Uploaded File Name Sheet'; COMMENT ON COLUMN tbl_import_folio_log.Step_1_Upload_file_path IS 'Uploaded File

  • Spark DataGrid -  Data Truncate

    HI, We need to display huge data in spark datagrid cell. We need to truncate the date by having dot dot dot and show all teh data in the tool tip. This is the last column of the datagrid. Any idea how it has to be done ? Thanks, Shweta