Designing Swing Applications - Layout

When using JDeveloper to design a Swing application (not ADF Swing) is it possible to;
1. when viewing the design of a frame for example, is it possible to display a grid so that you can align components correctly?
2. when you have selected a layout from the properties editor for the panel you are working on, is it possible to display the grid lines of that layout so that you can clearly see what component/group of components are in each of the areas? Similar to when using Macromedia Dreamweaver and dragging components into a table where you can see which cell each component is currently within...
3. add additional swing layouts to JDeveloper so that they can be used within the properties editor? i.e. tablelayout or design grid layout for example
4. has anyone come across any guides/tutorials on using JDeveloper to design Swing based applications visually by dragging and dropping components from the palette?
Thanks in advance for your help/advice
David

David - I had alot of those questions when I developed a Swing application. While I won't answer your question directly, take a look at this demo.
http://www.oracle.com/technology/products/jdev/tips/muench/screencasts/simplejgoodies/binding_demo.html?_template=/ocom/ocom_item_templates/print
The FormLayout as part of JGoodies managed makes the layout a lot easier - still a few things you have to get used to but it managed most of the hard stuff for your.
Let me know if that helps
Regards
Grant

Similar Messages

  • Designing Swing Applications

    I am currently designing a rather major Swing application. I am seeking information about reference materials on application frameworks and design. Most of the books out there don't focus on the issues I'm concerned with. They are either too focused on the individual GUI components, or structuring the domain's problem appropriately. Specifically, I'm hoping to find some references that talk about patterns and frameworks involved in application design.
    Specifically, I'm seeking best practices in application design. Dealing with the editor/document relationship, application control, configurable application properties (via property files of some format), etcetera. Any references or advice would be greatly appreciated.
    Jesse Blomberg
    Software engineer
    Essential Logic

    i second that. the JLAF Design book has some nice stuff in it. their use of the java.util.Properties object is keen, as well as the format of the corresponding files in the examples. regarding Documents...if you are doing editing, good luck. imho, a lot of the more advanced editors are incomplete implementations. for basic editing or creating something from scratch, you've got a lot of work ahead of you. (opinions from personal experience.)

  • What is the best MVC approach for designing Swing application

    Hi...
    I am designing an client/server application. In this I am using java swing for the front-end development. We decided on using MVC approach for the front-end design. I found that there are more than one approachs for designing in MVC.
    Which is the best way to model. To create your model taking View into consideration or Creating the Model taking the tables into consideration.
    Can anybody give help me out in this this is urgent. Thanks
    sai

    I'm not sure what you are asking, so I'll just ramble a bit and hope it helps.
    Create your model taking the view and the data into consideration. :-)
    Design a class to hold instances of the rows in your database that correspond (more or less) to the structure of the data. Add any needed methods to that data object to support the data that you might need for the view.
    For example, suppose your database stores a name in two columns (firstname and lastname). You pull that data from the database into a collection of Person objects into your model. Your Person class has two fields (and set/get methods) to hold that data. Now, in your view, you want to display the name as one string, so add a method to the Person object to get the full name (just by concatenating the two data elements).
    You have to take everything into consideration. How you are going to view the data as well as how it might be structured.

  • Design Patterns for java swing application front a J2EE server

    Hi,
    i dont nkow that i stay in the correct forum. I am development a java swing client application, no web, and i dont know that if there are any patterns for a client of this type.
    I have readed http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
    but after of Buissnes Delegate pattern, the others one, over ejb tier, are applicated only for web clients, using servlets and jsp pages.
    If i have a swing client application, what patterns i must folow for implement the client logic of my swing application??
    thanks

    MVC pattern is one of the most used
    http://en.wikipedia.org/wiki/MVC
    http://csis.pace.edu/~bergin/mvc/mvcgui.html
    ...

  • Book Recommendation for Building Swing Applications

    I'm looking for recommendations on books for building swing applications from the ground up.
    I'm not a strong GUI developer. 95% of my experience has been strictly on back end development in many other languages. What little GUI experience I have has been with C++ (years ago) and most recently with HTML.
    I know what I want to develop, and even have the GUI design for my application drawn out. I just need a good book that can walk me through developing the interface in Java.
    I already have several books on Java. But, I find them somewhat limiting because they don't help me build the app from the ground up.
    Yes, I've tried the online book on the Sun site, "The Jfc Swing Tutorial: Guide to Constructing Gui's".
    Please offer some recommendations and reasons on why you like the book.
    Thanks.

    A few comments to that ....
    the first thing is understanding the LayoutManagers, that are available.
    I will give you a short guideline where they are usefull:
    FlowLayout - usefull for JLabel-JTextField combinations or several JButtons
    BorderLayout - usefull for the structure of basic containers
    CardLayout - usefull for every area of the screen, where you want to appear different panels
    GridLayout - usefull for a group of same-sized components laid out in a grid
    GridBagLayout - usefull for a group of components, that have different sizes, very flexible
    JTabbedPane - a special container, that is similar to CardLayout but with visible tabs to switch panels
    Normally you can say "I want that group at the bottom of the frame, that other group at its left side, that toolbar at its top" - if you can say so - that shouts for BorderLayout. If you can say "in this area I want to use several panels" that means CardLayout or a JTabbedPane.
    You see, if you have an idea, what the LayoutManagers do, you know exactly which area needs what Layout - so you have a guideline, which LayoutManager to use in that panel.
    To make an example:
    You want 3 buttons centered at the bottom of a frame - this 3 buttoms should be of that size, that is needed by the button texts. So, what to do:
    1. create a JPanel with FlowLayout
    2. create the buttons and add it to that JPanel
    3. create another JPanel with BorderLayout
    4. add that first JPanel to the second JPanel at BorderLayout.CENTER
    5. add this Panel to the ContentPane of the frame at BorderLayout.SOUTH
    that is a simple panel in panel construct - placing 3 buttons centered at the bottom of the frame. You have to play with that different LayoutManagers a little bit - the way you stick one panel in another changes the look of the GUI - if you know, how it changes (by playing with the examples of the tutorial), you will have that "from the ground"-experience, you are looking for - believe me.
    greetings Marsian

  • How to give Common Background color for all JPanels in My Swing application

    Hi All,
    I am developing a swing application using The Swing Application Framework(SAF)(JSR 296). I this application i have multiple JPanel's embedded in a JTabbedPane. In this way i have three JTabbedPane embedded in a JFrame.
    Now is there any way to set a common background color for the all the JPanel's available in the application??
    I have tried using UIManager.put("Panel.background",new Color.PINK);. But it did not work.
    Also let me know if SAF has some inbuilt method or way to do this.
    Your inputs are valuable.
    Thanks in Advance,
    Nishanth.C

    It is not the fault of NetBeans' GUI builder, JPanels are opaque by default, I mean whether you use Netbeans or not.Thank you!
    I stand corrected (which is short for +"I jumped red-eyed on my feet and rushed to create an SSCCE to demonstrate that JPanels are... mmm... oh well, they are opaque by default... ;-[]"+)
    NetBeans's definitely innocent then, and indeed using it would be an advantage (ctrl-click all JPanels in a form and edit the common opaque property to false) over manually coding
    To handle this it would be better idea to make a subclass of JPanel and override isOpaque() to return false. Then use this 'Trasparent Panel' for all the panels where ever transparency is required.I beg to differ. From a design standpoint, I'd find it terrible (in the pejorative sense of the word) to design a subclass to inconsistently override a getter whereas the standard API already exposes the property (both get and set) for what it's meant: specify whether the panel is opaque.
    Leveraging this subclass would mean changing all lines where a would-be-transparent JPanel is currently instantiated, and instantiate the subclass instead.
    If you're editing all such lines anyway, you might as well change the explicit new JPanel() for a call to a factory method createTransparentJPanel(); this latter could, at the programmer's discretion, implement transparency whichever way makes the programmer's life easier (subclass if he pleases, although that makes me shudder, or simply call thePanel.setOpaque(false) before returning the panel). That way the "transparency" code is centralized in a single easy to maintain location.
    I had to read the code for that latter's UI classes to find out the keys to use (+Panel.background+, Label.foreground, etc.), as I happened to not find this info in an authoritative document - I see that you seem to know thoses keys, may I ask you where you got them from?
    One of best utilities I got from this forum, written by camickr makes getting these keys and their values very easy. You can get it from his blog [(->link)|http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/]
    Definitely. I bit a pair of knucles off when discovered it monthes after cumbersomely traversing the BasicL&F code...
    Still, it is a matter-of-fact approach (and this time I don't mean that to sound pejorative), that works if you can test the result for a given JDK version and L&F, but doesn't guarantee that these keys are there to stand - an observation, but not a specification.
    Thanks TBM for highlighting this blog entry, that's the best keys list device I have found so far, but the questions still holds as to what specifies the keys.
    Edited by: jduprez on Feb 15, 2010 10:07 AM

  • I want to implement thems functionality in  my swing application

    Hi All...
    I want to implement the themes object in my swing application,How ,where to start and move that functionality,If anybody use this functionality in your program experience can u share with me.
    Than to Advance
    ARjun...

    Hi Kuldeep Chitrakar
    I can do that in web intelligence. dont want that
    I am replicating some of the sample report of SQL Servers in BusinessObjects XI R3.1.
    One of the SQL Sever's report is of product catalogue type that gives complete information like name, category, description along with the products image etc... for each of the products.
    I am trying to replicate the above said SQL Server report in Business objects XI R3.1. I am facing problem in bringing the image in to my BO report. The image resides in a table and its datatype is of varbinary(max). I don't know the exact matching while creating an object in the uiverse designer.
    Here is the url link http://errorsbusinessobjectsxir3.blogspot.com/2010/10/business-objects-image-errors.html
    Regards
    Prasad

  • Need Help to update the labels in the GUI syncronously - Swing application

    Hello everyone,
    I need some help regarding a swing application. I am not able to syncronously update the counters and labels that display on my Swing GUI as the application runs in the background. But when the running of application is completed, then the labels on the GUI are getting updated, But I want update the labels and counters on the GUI syncronously as the code executes... below I am giving the format of the code I have written..............
    public class SwingApp extends JFrame{
            // here i have declared the label and component varibles like...
                      private JTextField startTextField;
           private JComboBox maxComboBox;
           private JTextField logTextField;
           private JTextField searchTextField;
           private JLabel imagesDownloaded1;
           private JLabel imagesDownloaded2;
           private JLabel imagesDidnotDownload1;
           private JLabel imagesDidnotDownload2;
                      private JButton startButton;
    //now in the constructer.............
    public Swing(){
    //I used gridbaglayout and wrote the code for the GUI to appear....
    startButton = new JButton("Start Downloading");
        startButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try{
                 actionSearch();   //actionSearch will contain all the code and the function calls of my application...........
            }catch(Exception e1){
                 System.out.println(e1);
        constraints = new GridBagConstraints();
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 5, 5);
        layout.setConstraints(startButton, constraints);
        searchPanel.add(startButton);
    //update is a function which initiates a thread which updates the GUI. this function will be called to pass the required variables in the application
    public void update(final int count_hits, final int counter_image_download1, final int didnot_download1) throws Exception{
         Thread thread = new Thread(new Runnable() {
             public void run() {
                  System.out.println("entered into thread");
                  System.out.println("the variable that has to be set is " + count_hits);
                  server_hits_count.repaint(count_hits);
                  server_hits_count.setText( " "+ Integer.toString(count_hits));
                  imagesDownloaded2.setText(" " + Integer.toString(counter_image_download1));
                  imagesDidnotDownload2.setText(" " + Integer.toString(didnot_download1));
                  repaint();
         //this.update(count_hits);
         thread.start();
    //Now in main............................
    public static void main(String[] args){
    Swing s = new Swing();
    s.setVisible(true);
    }//end of main
    }//end of class SwingAbove I have given the skeleton code of my application........ Please tell me how to update the GUI syncronously...
    Please its a bit urgent...............
    Thank you very much in advance
    chaitanya

    First off, note that this question should have been posted in the Swing section.
    GUI events run in a separate thread (the AWT / Event Dispatch Thread) than your program.
    You should be invoking AWT/Swing events via SwingUtilities.invokeLater().
    If for whatever reason you want to have the program thread wait for the event to process
    you can use invokeAndWait().
    http://java.sun.com/javase/6/docs/api/javax/swing/SwingUtilities.html

  • JNLP - Swing application compiled in jdk1.5 not working in jdk1.6

    I have one swing application, compiled in jdk 1.5 and deployed in JNLP with jdk 1.5. When client machine try to access the application and having jre 1.5 then it works fine. but if client machine having jre 1.6 or version greater than 1.5 then application does not work properly.
    Please help me, i got stuck and not able to solve the problem.
    this is my JNLP
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://10.1.1.145:8080/uttimesheet" href="launch.jnlp">
    <information>
    <title>TimeSheet Portal</title>
    <vendor>Geometric Global</vendor>
    <description>A simple java desktop application based on Swing Application Framework</description>
    <description kind="short">TimeSheet Portal</description>
    <homepage href="http://appframework.dev.java.net"/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+" />
    <jar href="UTTimeSheet.jar" main="true" download="eager"/>
    <jar href="lib/antlr-2.7.5H3.jar" download="eager"/>
    <jar href="lib/appframework-1.0.3.jar" download="eager"/>
    <jar href="lib/asm.jar" download="eager"/>
    <jar href="lib/cglib-2.1.jar" download="eager"/>
    <jar href="lib/commons-collections-2.1.1.jar" download="eager"/>
    <jar href="lib/commons-logging-1.0.4.jar" download="eager"/>
    <jar href="lib/dom4j-1.6.jar" download="eager"/>
    <jar href="lib/hibernate3.jar" download="eager"/>
    <jar href="lib/jta.jar" download="eager"/>
    <jar href="lib/log4j-1.2.9.jar" download="eager"/>
    <jar href="lib/poi-3.0.2.jar" download="eager"/>
    <jar href="lib/postgresql-8.3-603.jdbc3.jar" download="eager"/>
    <jar href="lib/swing-layout-1.0.3.jar" download="eager"/>
    <jar href="lib/swing-worker-1.1.jar" download="eager"/>
    <jar href="lib/swingx-0.9.2.jar" download="eager"/>
    </resources>
    <application-desc main-class="timesheetproject.TimeSheetProjectApp">
    </application-desc>
    </jnlp>
    Thanks in Advance.

    Thanks Luca for your time,
    we have deployed application in tomcat and changed the home page of tomcat to our application home page(html page). and url is http://10.1.1.145:8080/
    Application home page contain link to jnlp. so whenever user click on link (in home page) then jnlp will execute and launch the swing application.
    do you need some more clarification?
    below is the home page(html).
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Launch TimeSheet Portal via JNLP</title>
    </head>
    <body>
         <center>
              <br>
              <img src="images/Geo-logo.JPG" />          
              <br>
              <hr width="70%" />
              <br>
              <table width="70%">
                   <tr><td> </td></tr>
                   <tr>
                        <td colspan="2" align="center">
                             <align="center">
                                  <h2>Welcome to TimeSheet Portal.</h3>
                             </align>
                        </td>
                   </tr>
                   <tr><td> </td></tr>
                   <tr><td> </td></tr>
                   <tr>
                        <td align="center">
                             <align="center">
                                  <h3><u>Live Sites:</u></h3>
                             </align>
                        </td>
                        <td align="center">
                             <align="center">
                                  <h3><u>Demo Sites:</u></h3>
                             </align>
                        </td>
                   </tr>
                   <tr>
                        <td width="50%" align="center">
                             <img src="images/launchPortal.png" onmouseover="this.src='images/launchPortalMouseOver.png';" onmouseout="this.src='images/launchPortal.png';" border="0"/>          
                             <br><br>
                             <img src="images/launchAdminPortal.png" onmouseover="this.src='images/launchAdminPortalMouseOver.png';" onmouseout="this.src='images/launchAdminPortal.png';" border="0"/>          
                        </td>
                        <td width="50%" align="center">
                             <img src="images/demoPortal.png" onmouseover="this.src='images/demoPortalMouseOver.png';" onmouseout="this.src='images/demoPortal.png';" border="0"/>
                             <br><br>
                             <img src="images/demoAdminPortal.png" onmouseover="this.src='images/demoAdminPortalMouseOver.png';" onmouseout="this.src='images/demoAdminPortal.png';" border="0"/>
                        </td>
                   </tr>
                   <tr><td> </td></tr>
                   <tr><td> </td></tr>
         </table>
         <table width="70%">
              <tr><td> </td></tr>
              <tr><td> </td></tr>
              <tr><td align="center">
                   FAQ   |  
                   Help   |  
                   Why Timesheet   |  
                   Report a bug   |  
                   Contact Us   |  
    Subtask Mapping   
              </td></tr>
         </table>
         <br><br><br><br>
         <table width="70%" bgcolor="#C0C0C0" style="vertical-align: bottom">
              <tr>
                   <td colspan="2" align="center" style="vertical-align: bottom" bgcolor="#C0C0C0">
                        ©<font size="1.5" face="Verdana"> 2008 Geometric Ltd. All rights reserved.<br>
                             Best optimized for a resolution of 1024 and above. JRE 1.5 is a pre-requisite                          for using these applications.
                        </font>
                   </td>
              </tr>
         </table>
         </center>
    </body>
    </html>
    Thanks.

  • Swing application eats CPU on resume after standby

    My application contains a mix of regular Swing components and about 200 (small) custom components (JPanels) that draw themselves. The problem is that if put my laptop into Standby, then restart it, the application eats CPU. It goes from ~4% pre standby to ~48% after standby. Totally repeatable. There is only the main thread, the AWT thread and a couple timers firing: one to get data from a server and one to redraw the custom controls to make the control blink (calls repaint() to cue up a call to paintComponent()). I put timing code in the two timer driven threads and both are running fine. NOTE: each of the custom components is just a rectangle with a short text string in it. Think checkerboard with text. The background color is all that is being changed. It's basically a grid of alarm/status "lights".
    I did some searching and only found a reference to a drawing bug that was fixed back in 1.4.x that had to do with WinXP and dual-headed computers.
    Note that another simple Swing application I wrote (no custom controls), doesn't appear to behave this way, so I suspect it has to do with the custom drawing stuff (rolling my own paintComponent() method).
    Any thoughts on how to figure out what is eating the CPU? I'm using NetBeans 6.7 and JDK 1.6_14 under Windows XP.
    Edited by: garrysimmons on Sep 15, 2009 1:52 PM
    Edited by: garrysimmons on Sep 15, 2009 2:57 PM
    Edited by: garrysimmons on Sep 15, 2009 3:02 PM

    It doesn't matter if it's a Swing timer or a Util timer. It behaves the same either way. That was one of the first things I tried.
    I ended up refactoring the code to go from a grid of individual controls (think checker board where each square is a control that draws itself), to a single "board" control that draws a grid. That seems to have fixed the issue. I can go in/out of Standby and the app doesn't eat a ton of CPU any more. The real problem may still be there, just too small of an effect to notice.
    I don't know why the original design would work fine before a Standby, but not after. Having ~200 little controls doing repaints twice a second must confuse something in the JVM/Windows versus having 4 large controls doing the same amount of drawing.
    It's working, so time to move on.

  • Swing application doesn't launch

    Hallo,
    I've programmed a simple swing-application that was til now functionning correctly. But today I can't launch this application. If I launch it with java -jar myprog.jar I get following information:
    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: sun.font.FileFontStrike.createScalerContext(J[DZIIZFF)J
    at sun.font.FileFontStrike.createScalerContext(Native Method)
    at sun.font.FileFontStrike.<init>(Unknown Source)
    at sun.font.FileFont.createStrike(Unknown Source)
    at sun.font.Font2D.getStrike(Unknown Source)
    at sun.font.Font2D.getStrike(Unknown Source)
    at sun.font.CompositeStrike.getStrikeForSlot(Unknown Source)
    at sun.font.CompositeStrike.getFontMetrics(Unknown Source)
    at sun.font.FontDesignMetrics.initMatrixAndMetrics(Unknown Source)
    at sun.font.FontDesignMetrics.<init>(Unknown Source)
    at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
    at sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
    at javax.swing.JComponent.getFontMetrics(Unknown Source)
    at javax.swing.plaf.metal.MetalTitlePane$TitlePaneLayout.computeHeight(Unknown Source)
    at javax.swing.plaf.metal.MetalTitlePane$TitlePaneLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at javax.swing.plaf.metal.MetalRootPaneUI$MetalRootLayout.layoutContainer(Unknown Source)
    at java.awt.Container.layout(Unknown Source)
    at java.awt.Container.doLayout(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validate(Unknown Source)
    at java.awt.Window.pack(Unknown Source)
    at logviewer.Main$1.run(Main.java:61)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: sun.font.FileFontStrike.createScalerContext(J[DZIIZFF)J
    at sun.font.FileFontStrike.createScalerContext(Native Method)
    at sun.font.FileFontStrike.<init>(Unknown Source)
    at sun.font.FileFont.createStrike(Unknown Source)
    at sun.font.Font2D.getStrike(Unknown Source)
    at sun.font.Font2D.getStrike(Unknown Source)
    at sun.font.CompositeStrike.getStrikeForSlot(Unknown Source)
    at sun.font.CompositeStrike.getFontMetrics(Unknown Source)
    at sun.font.FontDesignMetrics.initMatrixAndMetrics(Unknown Source)
    at sun.font.FontDesignMetrics.<init>(Unknown Source)
    at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
    at sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
    at javax.swing.JComponent.getFontMetrics(Unknown Source)
    at javax.swing.plaf.metal.MetalTitlePane$TitlePaneLayout.computeHeight(Unknown Source)
    at javax.swing.plaf.metal.MetalTitlePane$TitlePaneLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at javax.swing.plaf.metal.MetalRootPaneUI$MetalRootLayout.layoutContainer(Unknown Source)
    at java.awt.Container.layout(Unknown Source)
    at java.awt.Container.doLayout(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validateTree(Unknown Source)
    at java.awt.Container.validate(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    after this output the application hangs, my windows commad prompt doesn't show the prompt.
    Secondary, it is not possible to launch the Java-Applet in Control Panel of Windows. It happans nothing.
    Whats going wrong? My program didn't change, it's the same program I was using since longer time. What could I do to make it function correctly?
    with regards
    Rafal Ziolkowski

    Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: sun.font.FileFontStrike.createScalerContext(J[DZIIZFF)J
    UnsatisfiedLinkError indicates that the JVM cannot find a native method's definition. Generally this means that the shared object file (.so on unices, .dll on Windows) cannot be found by the JVM.
    Since the missing method is visibly Sun's code, presumably a built-in JRE method, that probably means your JRE/JDK install has been corrupted (corroborated by a quick Google search on the obvious keywords).
    Try reinstalling the JRE or JDK.
    Secondary, it is not possible to launch the Java-Applet in Control Panel of Windows. It happans nothing. I don't understand this sentence. What are you doing exactly, and how is that related to the first question?
    Much luck,
    J.

  • How to use MVC in Swing application

    Hi,
    I'm creating an application using Java Swing. I want to use Model View Controller (MVC) architecture to design by application. I want to use MVC to seperate by business logic functionality from the control and presentation logic that uses this logic.
    I need your help to get this done successfully. Please send me a SAMPLE JAVA SWING APPLICATION where they have applied MVC, it will be helpful to me.
    Thank you,
    Regards
    kumar

    Would this be a basic example of an application that uses MVC?
    //MODEL
    public class Model {
         public void showMessage() {
              System.out.println("You clicked me!");
    //VIEW
    import javax.swing.JButton;
    import javax.swing.JPanel;
    public class View extends JPanel {
         private JButton buttonSave;
         public View() {
              super();
              initUI();
         public void initUI() {
              buttonSave = new JButton("Save");
              buttonSave.addActionListener(new Controller());
              add(buttonSave);
    //CONTROLLER
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Controller implements ActionListener {
         private Model m;
         public Controller() {
              m = new Model();
         public void actionPerformed(ActionEvent e) {
              m.showMessage();
    }Is this a correct implementation of MVC? I am trying to learn it, and use it in an example.
    Thanks for your help/input.

  • Image resize problem in Swing Application

    Hi All
    I need a help on resizing and adjustment of Image in Swing application.
    I am developing a Swing Application. There I am displaying a image on header.
    I am finding it difficult to manage the image, as I want the image to perfectly fit horizontal bounds(Even on window resize).
    The current code given below is unable to do so.. Even it's not able to fit the horizontal bounds by default.
    ========================================
    //code for image starts
            BufferedImage myPicture;
            JLabel picLabel = null;
            try {
                 myPicture = ImageIO.read(new File("artes_header.png"));
                    picLabel = new JLabel(new ImageIcon(myPicture));
              } catch (Exception e) {
            GridBagLayout gLayout = new GridBagLayout();
            getContentPane().setLayout(gLayout);
            GridBagConstraints c = new GridBagConstraints();
            c.gridx = 1;
            c.gridy = 1;
            c.weightx = 1;
            c.fill = GridBagConstraints.BOTH;
            c.insets = new Insets(0, 0, 0, 0);
            panelTop.setBackground(Color.white);
            getContentPane().add(picLabel, c);
            c.gridx = 1;
            c.gridy = 2;
            c.weightx = 1;
            c.weighty = 1;
            getContentPane().add(tabPane, c);========================================
    Kindly anyone help me solve the same issue.
    Many thanks in advance.
    Regards,
    Gaurav
    Edited by: user7668872 on Jul 31, 2011 6:25 AM
    Edited by: user7668872 on Aug 4, 2011 3:56 AM

    Your questions doesnt make a whole lot of sence so not sure if this is what you want...
    This is a class to display an image on a jpanel. You can then use layout managers to make sure it is centrally alligned
    import java.awt.*;
    import javax.swing.*;
    import java.awt.image.BufferedImage;
    import javax.imageio.ImageIO;
    import java.io.*;
    class testImagePanel{
        public static void main(String[] args){
            BufferedImage image = null;
            ImagePanel imagePanel = null;
            try{
                image = ImageIO.read(new File("image.jpg"));
                imagePanel = new ImagePanel(image);
                imagePanel.setLayout(new BorderLayout());
            }catch(IOException  e){
                 System.err.println("Error trying to read in image "+e);
            JFrame frame = new JFrame("Example");
            frame.add(imagePanel);
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);               
    public class ImagePanel extends JPanel {
        private BufferedImage image;
        private Dimension size;
        public ImagePanel(BufferedImage image) {
            this.image = image;
            this.size = new Dimension();
            size.setSize(image.getWidth(), image.getHeight());
            this.setBackground(Color.WHITE);
        @Override
        protected void paintComponent(Graphics g) {
            // Center image in this component.
            int x = (getWidth() - size.width)/2;
            int y = (getHeight() - size.height)/2;
            g.drawImage(image, x, y, this);
        @Override
        public Dimension getPreferredSize() { return size; }
    }

  • Is there free java chat, which i can embed in my Swing application

    Hello all,
    I have a Swing application and i want to embed java chat into it.
    Can you recommend me free chat for which i can see and modofy client and server sources.
    Regards,
    Chavdar

    No.

  • How to get mouse wheel action in my swing application?

    Hi
    In my mouse, i am having mousewheel to support scrolling.With the help of the wheel, i can scroll the pages in IE browser or any other appliction.
    In swing application ,i have scroll bar inside a JFrame.I want to have mousewheel action in my swing application to support scrolling.
    any idea ???
    Thanks

    As far as I know,there is no facility for detecting mouse scrolling wheel in JDK 1.3.
    Check it in the later releases of JDK.

Maybe you are looking for

  • I can't get Macbook Pro DVD drive to read my Windows 7 upgrade disk.

    I have a 15" Macbook Pro running OSX 10.6.8.  I have been trying to upgrade the OS in my VMWare Virtual Machine from XP to Windows 7.  However, when I insert the upgrade disk, it just spins for a few minutes and then tells me the disk is a blank disk

  • How do I write an OutputStream to a String?

    I'm using an ObjectOutputStream to serialize a LinkedList. I tried using a ByteArrayOutputStream and invoking the toString() method thereof, but it changes the first two entries in the array and throws off the readObject() method of the ObjectInputSt

  • Printer wont install

    printer was installed on my computer and worked fine then i had to restore my computer and now the software wil not install the printer keep getting  notification saying doesnt meet requirements and need administration help

  • Issue with payment terms

    Hi all, This is an urgent requirement. We need to change the payment terms from 21 NET to 28 NET for two purchase orders at the purchase order level. How can this be achieved ? Thanks

  • How can I edit a table in my iPhone?, How can I edit a table in my iPhone?

    I've set up a table in a pages document on my MacBook Air.  I've shared the document to iCloud.  I open the document in Pages on my iPhone, but can't edit any cell in the table. I can select a cell but my only option is to paste.  The iPhones keyboar