Conversion to swing

i wrote this program originally in awt, i just converted the buttons to JButtons and now my applet won't initialize, why?
import java.math.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.applet.*;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class Lab7 extends JApplet implements ActionListener
   private Container pane;
   Picture myPicture1 = new Picture (Color.blue, Color.black, Color.red);
   Picture myPicture2 = new Picture (Color.red, Color.yellow, Color.green);
   private JButton moveButton = new JButton ("Move Picture");
   private JButton sadButton = new JButton ("Sadness");
   private JButton switchButton = new JButton ("Switch Picture");
   int x = 50;
   boolean flag = true;
   public void init()
       setBackground(Color.black);
       moveButton.addActionListener(this);
       //switchButton.addActionListener(this);
       //sadButton.addActionListener(this);
       add(switchButton);
       add(moveButton);
       add(sadButton);
   public void paint(Graphics g)
   myPicture1.draw(g);
   myPicture1.setXY(300, 20);
   myPicture1.setXY(x, 20);
   myPicture1.draw(g);
   public void actionPerformed (ActionEvent ae)
       if (x > getSize().width - 175)
           /* 175 = diameter(150) + xOffset(10) + xIncrement(5)
        * + xOffsetToNotRunToEdge(10) n
        x = 0;
        else
        x += 5;
        repaint();
   class Picture {
       private Color faceColor;
       private Color eyeColor;
        private Color smileColor;
        private int x = 50;
        private int y = 30;
        public Picture (Color f, Color e, Color s)
            faceColor = f;
            eyeColor = e;
            smileColor = s;
        public void setXY(int newX, int newY)
            x = newX;  y = newY;
public void setColors(Color faceColor,
Color eyeColor, Color smileColor)
     this.faceColor = faceColor;
     this.eyeColor = eyeColor;
     this.smileColor = smileColor;
       public Color getFaceColor()
           return faceColor;
       public Color getEyeColor()
           return eyeColor;
           public Color getSmileColor()
               return smileColor;
           public void draw(Graphics g)
               g.setColor(faceColor);
               g.fillOval(x + 10, y + 40, 150, 150);
               g.setColor(eyeColor);
               g.fillOval(x + 60, y + 85, 10, 10);
               g.fillOval(x + 100, y + 85, 10, 10);
               g.setColor(smileColor);
               g.drawArc(x + 35, y + 75, 100, 100, 200, 140);
         class Picture2 {
         private Color topLight;
         private Color midLight;
         private Color lowLight;
         private int x = 50;
         private int y = 30;
         public Picture2 (Color f, Color e, Color s)
            topLight = f;
            midLight = e;
            lowLight = s;
        public void setXY(int newX, int newY)
            x = newX;  y = newY;
public void setColors(Color topLight,
Color midLight, Color lowLight)
     this.topLight = topLight;
     this.midLight = midLight;
     this.lowLight = lowLight;
       public Color gettopLight()
           return topLight;
       public Color getmidLight()
           return midLight;
           public Color getlowLight()
               return lowLight;
           public void draw(Graphics g)
               g.drawRect (100, 100, 50, 150);
               g.setColor(topLight);
               g.fillOval (100, 100, 50, 50);
               g.setColor(midLight);
               g.fillOval(100, 130, 50, 50);
               g.setColor(lowLight);
               g.fillOval(100, 160, 50, 50);
   }

the buttons are being added to the northPanel
import java.math.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.applet.*;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class Lab7 extends JApplet implements ActionListener
   private Container pane;
   Picture myPicture1 = new Picture (Color.blue, Color.black, Color.red);
   Picture myPicture2 = new Picture (Color.red, Color.yellow, Color.green);
   private JButton moveButton, switchButton, sadButton;
   private JPanel northPanel = new JPanel();
   private JPanel southPanel = new JPanel();
   int x = 50;
   boolean flag = true;
   public void init()
       setBackground(Color.black);
       moveButton.addActionListener(this);
       //switchButton.addActionListener(this);
       //sadButton.addActionListener(this);
       northPanel.add(switchButton);
       northPanel.add(moveButton);
       northPanel.add(sadButton);
       this.getContentPane().setLayout(new BorderLayout(30,5));
       moveButton = new JButton("Move Picture");
       switchButton = new JButton("Switch Picture");
       sadButton = new JButton("Sadness");
   public void paint(Graphics g)
   myPicture1.draw(g);
   myPicture1.setXY(300, 20);
   myPicture1.setXY(x, 20);
   myPicture1.draw(g);
   public void actionPerformed (ActionEvent ae)
       if (x > getSize().width - 175)
           /* 175 = diameter(150) + xOffset(10) + xIncrement(5)
        * + xOffsetToNotRunToEdge(10) n
        x = 0;
        else
        x += 5;
        repaint();
   class Picture {
       private Color faceColor;
       private Color eyeColor;
        private Color smileColor;
        private int x = 50;
        private int y = 30;
        public Picture (Color f, Color e, Color s)
            faceColor = f;
            eyeColor = e;
            smileColor = s;
        public void setXY(int newX, int newY)
            x = newX;  y = newY;
public void setColors(Color faceColor,
Color eyeColor, Color smileColor)
     this.faceColor = faceColor;
     this.eyeColor = eyeColor;
     this.smileColor = smileColor;
       public Color getFaceColor()
           return faceColor;
       public Color getEyeColor()
           return eyeColor;
           public Color getSmileColor()
               return smileColor;
           public void draw(Graphics g)
               g.setColor(faceColor);
               g.fillOval(x + 10, y + 40, 150, 150);
               g.setColor(eyeColor);
               g.fillOval(x + 60, y + 85, 10, 10);
               g.fillOval(x + 100, y + 85, 10, 10);
               g.setColor(smileColor);
               g.drawArc(x + 35, y + 75, 100, 100, 200, 140);
         class Picture2 {
         private Color topLight;
         private Color midLight;
         private Color lowLight;
         private int x = 50;
         private int y = 30;
         public Picture2 (Color f, Color e, Color s)
            topLight = f;
            midLight = e;
            lowLight = s;
        public void setXY(int newX, int newY)
            x = newX;  y = newY;
public void setColors(Color topLight,
Color midLight, Color lowLight)
     this.topLight = topLight;
     this.midLight = midLight;
     this.lowLight = lowLight;
       public Color gettopLight()
           return topLight;
       public Color getmidLight()
           return midLight;
           public Color getlowLight()
               return lowLight;
           public void draw(Graphics g)
               g.drawRect (100, 100, 50, 150);
               g.setColor(topLight);
               g.fillOval (100, 100, 50, 50);
               g.setColor(midLight);
               g.fillOval(100, 130, 50, 50);
               g.setColor(lowLight);
               g.fillOval(100, 160, 50, 50);
   }

Similar Messages

  • Encoding conversion in Swing?

    Hi,
    In working with text file, there is a default encoding to convert the charset into java String. We can check it with System.getProperty("file.encoding").
    How about in Swing component? Is there another default encoding to convert the text input in the JTextField to java String? I have searched a lot of forum topics but could not find the answer. Please help. Thanks.
    Best Regards,
    Leslie

    Hi Leslie,
    that's because there isn't one. Java Strings will always be in UTF-16 Unicode, period.
    The thing that will change encoding is what you input into Java, be it through a text file, a database, or input into text components.
    When you type into a textfield like you mention, the characters you type in will likely arrive in whatever encoding is your current OS default. Java will convert the encoding over to UTF-16 as it gets inputted.
    I imagine what you'd really like to do is input international characters into a textfield, right? Search on the Input Method Framework within this forum - there should be a fair bit of literature on it. It is the Java package that allows you to input I18N data into text components.
    Hope that helps!
    Martin Hughes

  • Can i use Web Start for applet servlet architecture

    Hello ,
    I am currently working on conversion of swings GUI to applet based so that it can be accessed any where from the network.
    Presently its a standalone application, requiring installation of the work station component on user's machine .This would access the database on other server using the JDBC ODBC drivers.The GUI would display the information from the database.
    The task is to make it accesible remotely using a webbrowser.I have thought of the following.
    1.
    Applet-->Servlet--->Database architecture
    I was wondering if i can do the same functionality with Webstart. I mean will i be able to deploy the present application and make connections to the host server.
    Please compare the options .

    No , this is not supported by Oracle.
    Regards Anders Northeved

  • Converting 1.0 event model to 1.1

    I am working on converting a game that uses the 1.0 event-handling model to 1.1 (in preparation for eventual conversion to Swing).
    I have reached the point of saturation where I'm probably missing the obvious things that will fix my problem, so I'm hoping someone here can get me on a better track.
    I'm working with a the class gsIndustry (you can see it at http://stardart.funkychickendesign.com/gsIndustry.java) which is a subclass of my GameState class, which in turn I have recently made a subclass of Panel. GameState.root is the applet.
    The functions down, drag, raise, etc. are all being overridden from GameState because they were involved in the 1.0 event-handling. Most everything seems to be working at the moment except processing ActionEvents from any of the buttons (you can ignore GraphicalButton, it's kind of a seperate issue).
    If anyone has guidance, it would be much appreciated.

    Here's an example of an anonymous class being used as an button ActionListener that conforms to the latest event model.
    myButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              // do whatever
    });

  • Swing to Image Conversion

    Anybody know how to go about converting a swing container (such as JFrame) into an image like JPEG or PNG? Also, is there any library to allow conversion into PDF?
    Thanks,
    Mehul.

    Ohh yeah..that's amazing.
    Another issue:
    I'm using a 3rd party charting software in which they have a Chart class that extends from JLayeredPane. Now this Chart component has other subcomponents like Legend and ChartArea. The Legend and ChartArea classes extend from JComponent. The ChartArea includes 2 things: a drawing rectangle and a plotting rectangle. The plotting rectangle is a part of the drawing rectangle. The drawing rectangle also includes other stuff such as the axes, some margins/boundaries etc.
    Now, what I am trying to do is to provide the ability for a user to select a portion of the drawing rectangle by dragging his mouse. To do this, I create a chart class extends from Chart and then provide a paintComponent method in which I adjust my coordinates so that they are for the ChartArea rather than Chart. But, here's the problem I'm seeing: Without calling setXOR in paintComponent, when I drag my mouse on the ChartArea, my selection box is visible only outside the plotting rectangle (but still within the drawing rectangle)..the rest of the plotting area also gets selected, but my selection there gets hidden behind the plotting area...so I can't really see what region i've selected. If I do call setXOR, then I can see the entire selection box on top of the plotting rectangle, but my plotting rectangle gets a little disoriented and discolored when I click on it (to do the selection).
    I'm not able to understand why I'm seeing this behavior. Any ideas?
    Thanks.

  • AWT to SWING conversion - i am so lost!!!

    Hi,
    i am hoping somebody's expertise can help me. i am still relatively new to java and have created this class in java which has an AWT gui, that enables a user to click a "load" button, which the user can then select the jpeg they want to load and the class loads the picture in the canvas. Once i had created it i realised that i actually need to do it in SWING, but the problem is that i dont know how to convert this AWT class to a SWING based class. I have included the code below, and would really appreciate it if somebody can show me how to convert my code so that it is in SWING instead.
    Thank you for your help.
    kind regards,
    Very Confused One
    --------------------------START OF CODE [ImageDicer.java] --------------------------
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.util.*;
    public class ImageDicer extends Frame
    public static void main(String[] args)
    String fileName = "default";
    if (args.length > 0) fileName = args[0];
    new ImageDicer(fileName);
    private static final String kBanner = "ImageDicer v1.0";
    public ImageDicer(String fileName)
    super(kBanner);
    createUI();
    loadImage(fileName);
    setVisible(true);
    private Panel mControlPanel;
    private void createUI()
    setFont(new Font("Serif", Font.PLAIN, 12));
    setLayout(new BorderLayout());
    final Label statusLabel = new Label("Welcome to " + kBanner + ".");
    Button loadButton = new Button("Load...");
    loadButton.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    FileDialog fd = new FileDialog(ImageDicer.this);
    fd.show();
    if (fd.getFile() == null) return;
    String path = fd.getDirectory() + fd.getFile();
    loadImage(path);
    mControlPanel = new Panel();
    mControlPanel.add(loadButton);
    mControlPanel.add(statusLabel);
    add(mControlPanel, BorderLayout.SOUTH);
    addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e)
    dispose();
    System.exit(0);
    private void adjustToImageSize()
    if (!isDisplayable()) addNotify(); // Do this to get valid Insets.
    Insets insets = getInsets();
    int w = mBufferedImage.getWidth() + insets.left + insets.right;
    int h = mBufferedImage.getHeight() + insets.top + insets.bottom;
    h += mControlPanel.getPreferredSize().height;
    setSize(w, h);
    private void center()
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension d = getSize();
    int x = (screen.width - d.width) / 2;
    int y = (screen.height - d.height) / 2;
    setLocation(x, y);
    private BufferedImage mBufferedImage;
    private void loadImage(String fileName)
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    MediaTracker mt = new MediaTracker(this);
    mt.addImage(image, 0);
    try { mt.waitForID(0); }
    catch (InterruptedException ie) { return; }
    if (mt.isErrorID(0)) return;
    mBufferedImage = new BufferedImage(image.getWidth(null),
    image.getHeight(null),
    BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = mBufferedImage.createGraphics();
    g2.drawImage(image, null, null);
    adjustToImageSize();
    center();
    validate();
    repaint();
    setTitle(kBanner + ": " + fileName);
    public void paint(Graphics g)
    if (mBufferedImage == null) return;
    Insets insets = getInsets();
    g.drawImage(mBufferedImage, insets.left, insets.top, null);
    --------------------------END OF CODE [ImageDicer.java] --------------------------

    Thanks again for your assistance. The class manages to compile now but there seems to be a bug in the program. Everytime i run the class, the window loads, but the load button does not appear. It only appears when you click aimlessly at the bottom of the window until u luckily click on it. i cannot understand why this is happening :s
    Again i am greatful for your help.
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.util.*;
    import javax.imageio.ImageIO;
    import java.net.*;
    import javax.swing.filechooser.*;
    public class ImageDicer extends JFrame
    String kBanner = "ImageDicer v1.0";
    JPanel mControlPanel;
    JLabel statusLabel;
    JButton loadButton;
    public BufferedImage mBufferedImage;
    public ImageDicer(String fileName)
    { Container pane=getContentPane();
         setTitle(kBanner);
         pane.setLayout(new BorderLayout());
    statusLabel = new JLabel("Welcome to " + kBanner + ".");
    loadButton = new JButton("Load...");
    loadButton.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    {  JFileChooser fd = new JFileChooser();
         int returnVal=fd.showOpenDialog(ImageDicer.this);
              if(returnVal==JFileChooser.APPROVE_OPTION)
                   {if (fd.getSelectedFile() == null)
                              {return;}
                                  File file=fd.getSelectedFile();
                                  String path=(String)file.getPath();
                                  loadImage(path);
    mControlPanel = new JPanel();
         mControlPanel.add(loadButton);
         mControlPanel.add(statusLabel);
    pane.add( BorderLayout.SOUTH, mControlPanel);
    public void adjustToImageSize()
    if (!isDisplayable()) addNotify(); // Do this to get valid Insets.
    Insets insets = getInsets();
    int w = mBufferedImage.getWidth() + insets.left + insets.right;
    int h = mBufferedImage.getHeight() + insets.top + insets.bottom;
    h += mControlPanel.getPreferredSize().height;
    setSize(w, h);
    public void center()
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension d = getSize();
    int x = (screen.width - d.width) / 2;
    int y = (screen.height - d.height) / 2;
    setLocation(x, y);
    public void loadImage(String fileName)
    Image image = Toolkit.getDefaultToolkit().getImage(fileName);
    MediaTracker mt = new MediaTracker(this);
    mt.addImage(image, 0);
    try { mt.waitForID(0); }
    catch (InterruptedException ie) { return; }
    if (mt.isErrorID(0)) return;
    mBufferedImage = new BufferedImage(image.getWidth(null),
    image.getHeight(null),
    BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = mBufferedImage.createGraphics();
    g2.drawImage(image, null, null);
    adjustToImageSize();
    center();
    validate();
    repaint();
    setTitle(kBanner + ": " + fileName);
    public void paint(Graphics g)
    if (mBufferedImage == null) return;
    Insets insets = getInsets();
    g.drawImage(mBufferedImage, insets.left, insets.top, null);
    public static void main(String[] args)
    String fileName = "default";
    if (args.length > 0) fileName = args[0];
    ImageDicer img=new ImageDicer(fileName);
    img.setSize(800,600);
    img.show();
    }

  • Conversion from awt to Swing, colored list widget, and awt update() method

    Now that my Interactive Color Wheel program/applet is in Swing, I guess I should continue my previous thread in here from the AWT forum ("list widget with different colors for each list item?"):
    * list widget with different colors for each list item?
    My current issue involves two canvas (well, JPanel) refresh issues likely linked to double buffering. You can see them by running the following file with "java -jar SIHwheel.jar":
    * http://r0k.us/rock/Junk/SIHwheel.jar
    [edit add]
    (Heh, I just noticed Firefox and Chrome under Windows 7 will allow you to run thie .jar directly from the link. Cool.)
    [edit]
    If you don't trust me and would rather run it as an applet, use:
    * http://r0k.us/rock/Junk/SIHwheel.html
    (For some reason the first issue doesn't manifest when running as applet.)
    1) The canvas goes "wonky-white" when the user first clicks on the wheel. What is supposed to happen is simply the user sees another dot on the wheel for his new selected color. Forcing a complete redraw via any of the GUI buttons at the bottom sets things right. The canvas behaves itself from then on, at least until minimized or resized, at which point one needs to click a GUI button again. I'll be disabling resizing, but minimizing will still be allowed.
    2) A button image, and sometimes toolTip text, from an entirely different JPanel will appear in the ULC (0,0) of my canvas.
    Upon first running the new Swing version, I had thought everything was perfect. I soon realized though that my old AWT update() method was never getting called. The desired case when the user clicks somewhere on the wheel is that a new dot appears on his selected color. This usually allows them to see what colors have been viewed before. The old paint(), and now paintComponent(), clear the canvas, erasing all the previous dots.
    I soon learned that Swing does not call update(). I had been using it to intercept refresh events where only one of the components on my canvas needing updating. Most usefully, don't redraw the wheel (and forget the dots) when you don't need to. The way I chose to handle this is to slightly modify the update() to a boolean method. I renamed it partialOnly() and call it
    at the beginning of paintComponent(). If it returns true, paintComponent() itself returns, and no clearing of the canvas occurs.
    Since I first posted about these two issues, I've kludged-in a fix to #1. (The linked .jar file does not contain this kludge, so you can see the issue.) The kludge is included in the following code snippet:
        public void paintComponent(Graphics g)
            Rectangle ulc;
         if (font == null)  defineFont(g);
         // handle partial repaints of specific items
         if (partialOnly(g))  return;
            ...  // follow with the normal, full-canvas refresh
        private boolean partialOnly(Graphics g)
         boolean     imDone = true;
         if (resized > 0)  // this "if { }" clause is my kludge
         {   // should enter on 1 or 2
             imDone = false;
             resized += 1;     // clock thru two forced-full paints
             if (resized > 2)  resized = 0;
            if (wedgeOnly)
             putDotOnWheel(g);
                paintWedge(g);
             drawSnake(g);
             drawSatSnake(g);
             updateLumaBars(g);
                wedgeOnly = false;
              else if (wheelOnly)
                wheelOnly = false;
              else
                imDone = false;  // was paint() when method was update() in the AWT version
            return(imDone);
        }Forcing two initial full paintComponent()s does whatever magic the double-buffering infrastructure needs to avoid the "wonky-white" problem. This also happens on a minimize; I've disabled resizing other than minimization. Even though it works, I consider it a kludge.
    The second issue is not solved. All I can figure is that the double buffers are shared between the two JPanels, and the artifact buttons and toolTips at (0,0) are the result. I tried simply clearing the top twenty lines of the canvas when partialOnly() returns true, but for some reason that causes other canvas artifacting further down. And that was just a second kludge anyway.
    Sorry for being so long-winded. What is the right way to avoid these problems?
    -- Rich
    Edited by: RichF on Oct 15, 2010 8:43 PM

    Darryl, I'm not doing any custom double buffering. My goal was to simply replicate the functionality of awt's update() method. And yes, I have started with the Swing tutorial. I believe it was there that I learned update() is not part of the Swing infrastructure.
    Problem 1: I don't see the effect you describe (or I just don't understand the description)Piet, were you viewing the program (via the .jar) or the applet (via the .html)? For whatever reason, problem 1 does not manifest itself as an applet, only a program. FTR I'm running JDK/JRE 1.6 under Windows 7. As a program, just click anywhere in the wheel. The whole canvas goes wonky-white, and the wheel doesn't even show. If it happens, you'll understand. ;)
    Are you aware that repaint() can have a rectangle argument? And are you aware that the Graphics object has a clip depicting the area that will be affected by painting? You might use these for your partial painting.Yes and yes. Here is an enumeration of most of the update regions:
    enum AoI    // areas of interest
        LUMA_SNAKE, GREY_SNAKE, HUEBORHOOD, BULB_LABEL, LUMA_WEDGE,
        LAST_COLOR, BRIGHTNESS_BOX, INFO_BOX, VERSION,
        COLOR_NAME, EXACT_COLOR, LUMA_BUTTON, LUMA_BARS, GUI_INTENSITY,
        QUANTIZATION_ERROR
    }That list doesn't even include the large color intensity wedge to the right, nor the color wheel itself. I have a method that will return a Rectangle for any of the AoI's. One problem is that the wheel is a circle, and a containing rectangle will overlap with some of the other AoI's. I could build an infrastructure to handle this mess one clip region at a time, but I think it would add a lot of unnecessary complexity.
    I think the bigger picture is that, though it is now updated to Swing, some of the original 1998 design decisions are no longer relevant. Back then I was running Windows 98 on a single-core processor clocked at significantly less than 1 GHz. You could actually watch the canvas update itself. The color wheel alone fills over 1000 arcs, and the color intensity wedge has over 75 update regions of its own. While kind of interesting to watch, it's not 1998 any more. My multi-core processor runs at over 2 GHz, and my graphic card is way, way beyond anything that existed last century. Full canvas updates probably take less than 0.1 sec, and that is with double-buffering!
    So, I think you're right. Let the silly paintComponent() do it's thing unhindered. If I want to track old dots on the wheel, keep an array of Points, remembering maybe the last 10. As a final step in the repainting process, decide how many of those old dots to display, and do it.
    Thanks, guys, for being a sounding board.
    Oh, I'm moving forward on implementing the color list widget. I've already added a 3rd JPanel, which is a column to the left of the main paint canvas. It will contain 3 GUI items:
    1) the color list widget itself, initially sorted by name
    2) 3 radio buttons allowing user to resort the list by name, hue, or hex
    3) a hex-entry JTextField (which is all that is there at this very moment), allowing exact color request
    The color list widget will fill most of the column from the top, followed by the radio buttons, with hex-entry at bottom.
    For weeks I had in mind that I wanted a pop-up color list widget. Then you shared your ColorList class, and it was so obvious the list should just be there all the time. :)
    -- Rich

  • Conversion tool from JSP to SWING

    Hi,
    I have to convert all my JSP pages into SWING. Is there any tool which can convert JSP pages into SWING?
    Thanks,
    Prakash

    You're passing the string as a number in the onclick call to ChangeAbu.
    Add quotes around the <%=PccrNumber%> to make it a string:
    So change
    > " onclick="ChangeAbu(<%=PccrNumber%>)"></td>
    to
    " onclick="ChangeAbu('<%=PccrNumber%>')"></td>
    and see if that helps

  • Swings to JSP conversion

    We have a huge swing application which was developed long back, Is there any tool where in we can convert the swing GUI into JSP. We need only the frontend to be changed , the business logic remains same in the back end

    yeah, JSP is not a front end GUI... HTML is the front end GUI. And there's sure no simple way to convert Swing to HTML. There's not very many overlapping components, except labels, text fields and comboboxes. If you could write a converter to do that, I bet you could make some money off it.

  • Help Plz! AWT to Swing Conversion

    Hey everyone, I'm new to java and trying to convert this AWT program to Swing, I got no errors, the menu shows but they dont work !! Could somebody please help me? thanks alot!
    Current Under-Construction Code: (no errors)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class zipaint extends JFrame implements ActionListener,      ItemListener,
    MouseListener, MouseMotionListener, WindowListener {
    static final int WIDTH = 800;     // Sketch pad width
    static final int HEIGHT = 600;     // Sketch pad height
    int upperLeftX, upperLeftY;     // Rectangle upper left corner coords.
    int width, height;          // Rectangle size
    int x1, y1, x2, y2, x3, y3, x4, y4; // Point coords.
    boolean fillFlag = false; //default filling option is empty
    boolean eraseFlag = false; //default rubber is off
    String drawColor = new String("black"); //default drawing colour is black
    String drawShape = new String("brush"); //default drawing option is brush
    Image background; //declear image for open option
    private FileDialog selectFile = new FileDialog( this,
    "Select background (.gif .jpg)",
    FileDialog.LOAD );
    // Help
    String helpText = "Draw allows you to sketch different plane shapes over a " +
    "predefined area.\n" + "A shape may be eother filled or in outline, " +
    "and in one of eight different colours.\n\n" + "The position of the " +
    "mouse on the screen is recorded in the bottom left-hand corner of the " +
    "drawing area. The choice of colour and shape are disoplayed also in the " +
    "left-habnd corner of the drawing area.\n\n" + "The size of a shape is " +
    "determined by the mouse being dragged to the final position and " +
    "released. The first click of the mouse will generate a reference dot on " +
    "the screen. This dot will disapear after the mouse button is released.\n\n" +
    "Both the square and the circle only use the distance measured along the " +
    "horizontal axis when determining the size of a shape.\n\n" + "Upon " +
    "selecting erase, press the mouse button, and move the mouse over the " +
    "area to be erased. releasing the mouse button will deactivate erasure.\n\n" +
    "To erase this text area choose clearpad from the TOOLS menu.\n\n";
    // Components
    JTextField color = new JTextField();
    JTextField shape = new JTextField();
    JTextField position = new JTextField();
    CheckboxGroup fillOutline = new CheckboxGroup();
    JTextArea info = new JTextArea(helpText,0,0/*,JTextArea.JSCROLLBARS_VERTICAL_ONLY*/);
    JFrame about = new JFrame("About Zi Paint Shop");
    // Menues
    String[] fileNames = {"Open","Save","Save as","Exit"};
    String[] colorNames = {"black","blue","cyan","gray","green","magenta","red","white","yellow"};
    String[] shapeNames = {"brush","line","square","rectangle","circle","ellipse"};
    String[] toolNames = {"erase","clearpad"};
    String[] helpNames = {"Help","about"};
    public zipaint(String heading) {
    super(heading);
    getContentPane().setBackground(Color.white);
    getContentPane().setLayout(null);
    /* Initialise components */
    initialiseTextFields();
    initializeMenuComponents();
    initializeRadioButtons();
    addWindowListener(this);
    addMouseListener(this);
    addMouseMotionListener(this);
    /* Initialise Text Fields */
    private void initialiseTextFields() {
    // Add text field to show colour of figure
    color.setLocation(5,490);
    color.setSize(80,30);
    color.setBackground(Color.white);
    color.setText(drawColor);
    getContentPane().add(color);
    // Add text field to show shape of figure
    shape.setLocation(5,525);
    shape.setSize(80,30);
    shape.setBackground(Color.white);
    shape.setText(drawShape);
    getContentPane().add(shape);
    // Add text field to show position of mouse
    position.setLocation(5,560);
    position.setSize(80,30);
    position.setBackground(Color.white);
    getContentPane().add(position);
    // Set up text field for help
    info.setLocation(150,250);
    info.setSize(500,100);
    info.setBackground(Color.white);
    info.setEditable(false);
    private void initializeMenuComponents() {
    // Create menu bar
    JMenuBar bar = new JMenuBar();
    // Add colurs menu
    JMenu files = new JMenu("Files");
    for(int index=0;index < fileNames.length;index++)
    files.add(fileNames[index]);
    bar.add(files);
    files.addActionListener(this);
    // Add colurs menu
    JMenu colors = new JMenu("COLORS");
    for(int index=0;index < colorNames.length;index++)
    colors.add(colorNames[index]);
    bar.add(colors);
    colors.addActionListener(this);
    // Add shapes menu
    JMenu shapes = new JMenu("SHAPES");
    for(int index=0;index < shapeNames.length;index++)
    shapes.add(shapeNames[index]);
    bar.add(shapes);
    shapes.addActionListener(this);
    // Add tools menu
    JMenu tools = new JMenu("TOOLS");
    for(int index=0;index < toolNames.length;index++)
    tools.add(toolNames[index]);
    bar.add(tools);
    tools.addActionListener(this);
    // Add help menu
    JMenu help = new JMenu("HELP");
    for(int index=0;index < helpNames.length;index++)
    help.add(helpNames[index]);
    bar.add(help);
    help.addActionListener(this);
    // Set up menu bar
    setJMenuBar(bar);
    /* Initilalise Radio Buttons */
    private void initializeRadioButtons() {
    // Define checkbox
    Checkbox fill = new Checkbox("fill",fillOutline,false);
    Checkbox outline = new Checkbox("outline",fillOutline,true);
    // Fill buttom
    fill.setLocation(5,455);
    fill.setSize(80,30);
    getContentPane().add(fill);
    fill.addItemListener(this);
    // Outline button
    outline.setLocation(5,420);
    outline.setSize(80,30);
    getContentPane().add(outline);
    outline.addItemListener(this);
    /* Action performed. Detects which item has been selected from a menu */
    public void actionPerformed(ActionEvent e) {
    Graphics g = getGraphics();
    String source = e.getActionCommand();
    // Identify chosen colour if any
    for (int index=0;index < colorNames.length;index++) {
    if (source.equals(colorNames[index])) {
    drawColor = colorNames[index];
    color.setText(drawColor);
    return;
    // Identify chosen shape if any
    for (int index=0;index < shapeNames.length;index++) {
    if (source.equals(shapeNames[index])) {
    drawShape = shapeNames[index];
    shape.setText(drawShape);
    return;
    // Identify chosen tools if any
    if (source.equals("erase")) {
    eraseFlag= true;
    return;
    else {
    if (source.equals("clearpad")) {
    remove(info);
    g.clearRect(0,0,800,600);
    return;
    if (source.equals("Open")) {
    selectFile.setVisible( true );
    if( selectFile.getFile() != null )
    String fileLocation = selectFile.getDirectory() + selectFile.getFile();
    background = Toolkit.getDefaultToolkit().getImage(fileLocation);
    paint(getGraphics());
    if (source.equals("Exit")) {
    System.exit( 0 );
    // Identify chosen help
    if (source.equals("Help")) {
    getContentPane().add(info);
    return;
    if (source.equals("about")) {
    displayAboutWindow(about);
    return;
    public void paint(Graphics g)
    super.paint(g);
    if(background != null)
    Graphics gc = getGraphics();
    gc.drawImage( background, 0, 0, this.getWidth(), this.getHeight(), this);
    /* Dispaly About Window: Shows iformation aboutb Draw programme in
    separate window */
    private void displayAboutWindow(JFrame about) {
    about.setLocation(300,300);
    about.setSize(350,160);
    about.setBackground(Color.cyan);
    about.setFont(new Font("Serif",Font.ITALIC,14));
    about.setLayout(new FlowLayout(FlowLayout.LEFT));
    about.add(new Label("Author: Zi Feng Yao"));
    about.add(new Label("Title: Zi Paint Shop"));
    about.add(new Label("Version: 1.0"));
    about.setVisible(true);
    about.addWindowListener(this);
    // ----------------------- ITEM LISTENERS -------------------
    /* Item state changed: detect radio button presses. */
    public void itemStateChanged(ItemEvent event) {
    if (event.getItem() == "fill") fillFlag=true;
    else if (event.getItem() == "outline") fillFlag=false;
    // ---------------------- MOUSE LISTENERS -------------------
    /* Blank mouse listener methods */
    public void mouseClicked(MouseEvent event) {}
    public void mouseEntered(MouseEvent event) {}
    public void mouseExited(MouseEvent event) {}
    /* Mouse pressed: Get start coordinates */
    public void mousePressed(MouseEvent event) {
    // Cannot draw if erase flag switched on.
    if (eraseFlag) return;
    // Else set parameters to 0 and proceed
    upperLeftX=0;
    upperLeftY=0;
    width=0;
    height=0;
    x1=event.getX();
    y1=event.getY();
    x3=event.getX();
    y3=event.getY();
    Graphics g = getGraphics();
    displayMouseCoordinates(x1,y1);
    public void mouseReleased(MouseEvent event) {
    Graphics g = getGraphics();
    // Get and display mouse coordinates
    x2=event.getX();
    y2=event.getY();
    displayMouseCoordinates(x2,y2);
    // If erase flag set to true reset to false
    if (eraseFlag) {
    eraseFlag = false;
    return;
    // Else draw shape
    selectColor(g);
    if (drawShape.equals("line")) g.drawLine(x1,y1,x2,y2);
    else if (drawShape.equals("brush"));
    else drawClosedShape(drawShape,g);
    /* Display Mouse Coordinates */
    private void displayMouseCoordinates(int x, int y) {
    position.setText("[" + String.valueOf(x) + "," + String.valueOf(y) + "]");
    /* Select colour */
    private void selectColor(Graphics g) {
    for (int index=0;index < colorNames.length;index++) {
    if (drawColor.equals(colorNames[index])) {
    switch(index) {
    case 0: g.setColor(Color.black);break;
    case 1: g.setColor(Color.blue);break;
    case 2: g.setColor(Color.cyan);break;
    case 3: g.setColor(Color.gray);break;
    case 4: g.setColor(Color.green);break;
    case 5: g.setColor(Color.magenta);break;
    case 6: g.setColor(Color.red);break;
    case 7: g.setColor(Color.white);break;
    default: g.setColor(Color.yellow);
    /* Draw closed shape */
    private void drawClosedShape(String shape,Graphics g) {
    // Calculate correct parameters for shape
    upperLeftX = Math.min(x1,x2);
    upperLeftY = Math.min(y1,y2);
    width = Math.abs(x1-x2);
    height = Math.abs(y1-y2);
    // Draw appropriate shape
    if (shape.equals("square")) {
    if (fillFlag) g.fillRect(upperLeftX,upperLeftY,width,width);
    else g.drawRect(upperLeftX,upperLeftY,width,width);
    else {
    if (shape.equals("rectangle")) {
    if (fillFlag) g.fillRect(upperLeftX,upperLeftY,width,height);
    else g.drawRect(upperLeftX,upperLeftY,width,height);
    else {
    if (shape.equals("circle")) {
    if (fillFlag) g.fillOval(upperLeftX,upperLeftY,width,width);
    else g.drawOval(upperLeftX,upperLeftY,width,width);
    else {
    if (fillFlag) g.fillOval(upperLeftX,upperLeftY,width,height);
    else g.drawOval(upperLeftX,upperLeftY,width,height);
    /* Mouse moved */
    public void mouseMoved(MouseEvent event) {
    displayMouseCoordinates(event.getX(),event.getY());
    /* Mouse dragged */
    public void mouseDragged(MouseEvent event) {
    Graphics g = getGraphics();
    x2=event.getX();
    y2=event.getY();
    x4=event.getX();
    y4=event.getY();
    displayMouseCoordinates(x1,y1);
    if (eraseFlag) g.clearRect(x2,y2,10,10);
    else {
    selectColor(g);
    if(drawShape.equals("brush")) g.drawLine(x3,y3,x4,y4);
    x3 = x4;
    y3 = y4;
    // ---------------------- WINDOW LISTENERS -------------------
    /* Blank methods for window listener */
    public void windowClosed(WindowEvent event) {}
    public void windowDeiconified(WindowEvent event) {}
    public void windowIconified(WindowEvent event) {}
    public void windowActivated(WindowEvent event) {}
    public void windowDeactivated(WindowEvent event) {}
    public void windowOpened(WindowEvent event) {}
    /* Window Closing */
    public void windowClosing(WindowEvent event) {
    if (event.getWindow() == about) {
    about.dispose();
    return;
    else System.exit(0);
    Code End
    Thanks again!
    class ziapp {
    /* Main method */
    public static void main(String[] args) {
    zipaint screen = new zipaint("Zi Paint Shop");
    screen.setSize(zipaint.WIDTH,zipaint.HEIGHT);
    screen.setVisible(true);

    First of all use the [url http://forum.java.sun.com/features.jsp#Formatting]Formatting Tags when posting code to the forum. I'm sure you don't code with every line left justified so we don't want to read unformatted code either.
    Hey everyone, I'm new to java and trying to convert this AWT program to SwingInstead of converting the whole program, start with something small, understand how it works and then convert a different part of the program. You can start by reading this section from the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html]How to Use Menus.
    From a quick glance of your code it looks like you are not adding an ActionListener to your JMenuItems. You are adding them to the JMenu.
    Other observations:
    1) Don't mix AWT with Swing components. You are still using CheckBox
    2) Don't override paint(). When using Swing you should override paintComponent();
    3) Use LayoutManagers. Using a null layout does not allow for easy maintenance of the gui. Right now you are using 800 x 600 as your screen size. Most people are probably using at least 1024 x 768 screen sizes. When using LayoutManagers you would suggest component sizes by using setPreferredSize(), not setSize().

  • Query not running in sql developer, neither connecting to database. Following error - java.util.UnknownFormatConversionException: Conversion = '0'. Please reply soon.

    when i try to connect to oracle 11g rdbms, following error occurs -->
    1. sql developer version - 4.0.3.16 (jdk - jdk1.7.0_51 externally installed) -- newly installed, giving following error when try to connect to oracle 11g rdbms.
    2. sql developer version - 3.1.07.42 (jre1.6.0 included) -- used to run earlier.
    java.util.UnknownFormatConversionException: Conversion = '0'
      at java.util.Formatter.checkText(Formatter.java:2547)
      at java.util.Formatter.parse(Formatter.java:2533)
      at java.util.Formatter.format(Formatter.java:2469)
      at java.util.Formatter.format(Formatter.java:2423)
      at java.lang.String.format(String.java:2797)
      at oracle.dbtools.raptor.backgroundTask.internal.SimpleRaptorTaskUI.getFormattedTime(SimpleRaptorTaskUI.java:288)
      at oracle.dbtools.raptor.backgroundTask.internal.RaptorTaskUI.setState(RaptorTaskUI.java:43)
      at oracle.dbtools.raptor.backgroundTask.internal.SimpleRaptorTaskUI.<init>(SimpleRaptorTaskUI.java:63)
      at oracle.dbtools.raptor.backgroundTask.internal.RaptorTaskUI.<init>(RaptorTaskUI.java:36)
      at oracle.dbtools.raptor.backgroundTask.ui.TaskProgressViewer$4.<init>(TaskProgressViewer.java:346)
      at oracle.dbtools.raptor.backgroundTask.ui.TaskProgressViewer.createTaskUI(TaskProgressViewer.java:346)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.initViewers(RaptorTaskManager.java:373)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.access$400(RaptorTaskManager.java:45)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$4.run(RaptorTaskManager.java:299)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.invokeInDispatchThreadIfNeeded(RaptorTaskManager.java:313)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.addTask(RaptorTaskManager.java:302)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.addTask(RaptorTaskManager.java:200)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.addTask(RaptorTaskManager.java:161)
      at oracle.dbtools.worksheet.editor.OpenWorksheetWizard.invoke(OpenWorksheetWizard.java:425)
      at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:446)
      at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:390)
      at oracle.dbtools.worksheet.editor.WorksheetOpenController$1.run(WorksheetOpenController.java:84)
      at oracle.dbtools.worksheet.editor.WorksheetOpenController.openWorksheetWizard(WorksheetOpenController.java:90)
      at oracle.dbtools.worksheet.editor.WorksheetOpenController.handleEvent(WorksheetOpenController.java:49)
      at oracle.ide.controller.IdeAction$ControllerDelegatingController.handleEvent(IdeAction.java:1482)
      at oracle.ide.controller.IdeAction.performAction(IdeAction.java:663)
      at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:1153)
      at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:618)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
      at java.awt.Component.processMouseEvent(Component.java:6505)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
      at java.awt.Component.processEvent(Component.java:6270)
      at java.awt.Container.processEvent(Container.java:2229)
      at java.awt.Component.dispatchEventImpl(Component.java:4861)
      at java.awt.Container.dispatchEventImpl(Container.java:2287)
      at java.awt.Component.dispatchEvent(Component.java:4687)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
      at java.awt.Container.dispatchEventImpl(Container.java:2273)
      at java.awt.Window.dispatchEventImpl(Window.java:2719)
      at java.awt.Component.dispatchEvent(Component.java:4687)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
      at java.awt.EventQueue$4.run(EventQueue.java:708)
      at java.awt.EventQueue$4.run(EventQueue.java:706)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
      at oracle.javatools.internal.ui.EventQueueWrapper._dispatchEvent(EventQueueWrapper.java:169)
      at oracle.javatools.internal.ui.EventQueueWrapper.dispatchEvent(EventQueueWrapper.java:151)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

    Around a month ago, a similar question appeared on Jeff's block... look for checkText in http://www.thatjeffsmith.com/ask-a-question/
    There was no resolution there, so (as the SQL Developer code in that area has not changed) I would tend to think it might have something to do with
    1. Your Locale affecting the Formatter class's parsing of that pattern; or
    2. A bug in the jdk version in use, probably also related to the Locale.
    I recommend upgrading to the latest jdk1.7.0_xx update.  If that does not solve the issue, then try changing the Locale.

  • Unicode conversion in situ

    Hi SCN,
    I'm looking at the possibility of running a Combined Upgrade & Unicode Conversion (CUUC) in-situ; i.e. without a migration to new hardware.
    However in all my years of SAP Basis projects any Unicode conversion I've seen has involved a migration to new hardware (which makes good sense as the process is the same as an OSDB migration with R3load/MigMon).
    What I want to know is - has anyone ever run one in-place. I.e. keeping the same server and running the CUUC entirely inplace?
    This seems logically problematic as you need a target system to import to.
    I can imagine a process along these lines though...:
    1. Take SAP layer offline
    2. Run full backup of system
    3. Export system
    4. Drop database* (to make clean ready for new import)
    5. Run SPUMG/SUMG/SAPINST to setup Unicode database ready to receive import...
    6. ....and continue to run import into that database
    7. Complete Unicode conversion process
    However the big issue here for me is
    (a) *dropping the live production system is far from attractive.... I'm presuming everyone would do as I've always seen and combine this with a migration to new improved hardware, so that a backout to the old system is simple
    (b) I'm not sure at what point with the SAP tools (SPUMG/SUMG/SAPINST) this process would become convoluted with it all being in-situ on the same box. I.e. I'm not sure if it's something the SAP tools are really designed to cater for.
    Any input/discussion on these points would be very welcome.
    Regards, doonan_79

    FYI Community. Feeling after reading and research is to use a temorary server to import unicode converted system data into; then swing disks back to the original host. Making all required hostname updates during the process.
    Allowing for parallel export/import, but going back to the original configured host to complete the process.

  • Java Swing and Socket Programming

    I am making a Messenger like yahoo Messenger using Swing and Socket Programming ,Multithreading .
    Is this techology feasible or i should try something else.
    I want to display my messenger icon on task bar as it comes when i install and run Yahoo Messenger.
    Which class i should use.

    I don't really have an answer to what you are asking. But I am developing the same kind of application. I am using RMI for client-server and server-server (i have distributed servers) communication and TCP/IP for client-client. So may be we might be able to help each other out. My email id is [email protected]
    Are you opening a new socket for every conversation? I was wondering how to multithread a socket to reuse it for different connections, if it is possible at all.
    --Poonam.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Multifont output in Swing components

    Hi there,
    though I'm not new to Java but I'm new to displaying different fonts in Swing components.
    I have an Swing-based application which is running on a Terminal Server. It works fine for Central, Western und Northern Europe. The next
    country to roll out is Greece. So what does a greek user see on his monitor when he uses his greek keyboard?
    I am writing a test app where I type german text into a JTextField and want to get e.g. the greek representation in another JTextField. How can I achieve this? Converting the bytearray with Cp1253 did not work
    Can anybody give me a hint?
    Thanks
    Dierk.

    as I wrote, it is a test app to learn how I get greek
    fonts on the screen. Of course the real app is used by
    greek users who put greek text into the system. In the
    system we do not use resource bundles as the GUI texts
    are stored in the database. It is a CMS for product
    information in different languages.Ah, I see... mind you, I don't think your German text would have a great deal of Cyrillic characters in them, right? Still, it's only a test! ;-)
    Now what I'm doing to get my german text in greek
    letters is this:
    utf8Bytes =
    = getorigTextField().getText().getBytes("UTF16");
    isr = new InputStreamReader(new
    w ByteArrayInputStream
    (utf8Bytes), "Cp1253");
    As far as I understand, the InputStreamReader gives
    the translation
    of my german letters in the encoding of CP1253
    (Windows Greek). That
    means the unicode characters change into the ones of
    the greek language
    so I should be able to show them in a Swing component.This is where your problem is. Java's Strings will always be in UTF-16 when they are held internally. So anything within a textfield is going to be UTF-16 no matter what you do with it.
    The line you think is converting to Cp1253 is actually trying to convert from Cp1253 to UTF-16.
    Hopefully this is the reason your characters aren't appearing - the unneeded conversion above could be mashing them. Instead, you need expect everything to always be in UTF-16, and to expect to display in it (don't worry, it handles any character you can throw at it, let alone Greek). So then it all comes down to the font you're using.
    I'm not too sure of the name of the Windows default Cyrillic font, but that would be a logical starting point.
    Hope that helps!
    Martin Hughes

  • How to convert oracle form fmb file to java swing file using Jdeveloper

    how to convert oracle form fmb file to java swing file using Jdeveloper.Please explain with detailes steps if possible or please give a link where it is available
    thanks
    Message was edited by:
    user591884

    There is no automatic way to do this in JDeveloper. I know there are some Oracle Partners offering forms to java conversion, I don't know how much of their tools are automated and done with JDeveloper. With JDeveloper+ADF you basically rewriting the Forms application from scratch (and using ADF is helpful during this process).

Maybe you are looking for

  • IPhone 6 Plus 128 Availability Updates (will be updating as I continue making contact with Verizon and Apple retailers)

    I figure I would compile a list of things I have heard from Verizon reps as well as Apple retailers for anyone curious First Contact:  Verizon Wireless Preorder 9/12 for 6+ 128 Space Gray made at 12:17am PST at full-retail.  Small chat with represent

  • How to increase the battery life of your N series ...

    What I am about to post here is valid for any 3G phone or device regardless of model but it is particularly focused towards the N series devices and their power hogging features. Your battery life is dependant on many many things. How often you take

  • Navigation link based on user

    Hi All, I would like to give the navigation to column based on users login in a dashboard report. Suppose I have 5 users. 2 Should have navigation and 3 shouldn't have navigation when they login. Could anybody suggest on this how to achieve? I'm usin

  • Can't import large photos from android

    HEllo, my friend has a galaxy s3 and is trying to import her pics in her macbook with the new photos app. The thing is pictures above 2000x1500 pixel resolution won't import in the app, it gives a -9912 error. below that resolution everything is fine

  • What is link of Service Conditions for PO which is stored in KONV table?

    Hi Gurus, I want to fetch the details of Service Condition for a particular line item, i have found the entry in KONV table by searching on amount. Do you know how Service Conditions are stored in KONV and how they can be linked to a purchase order?