SerialversionUID Changes in JAVA 5

I have an application which has Serializable classes. The application works in a cluster environment where these classes get serialized and deserialized. None of the classes declare an serialVersionUID variable explicitly.
My question is: Based on the changes in Serialization changes in JAVA 5, how do I decide whether I really need to declare serialVersionUID field explicitly for my classes?

I am a colleague of Puneet's. The serialization is not something we do; it is something that a Servlet Container does for (to?) us. There is persistence of these objects, but it's "temporary persistence" in that it will not span any versions of anything. The persistence will never last more than a few hours.
I think this explains why this has not been an issue for us, and why we have not been interested in it. It sounds like we should go ahead and use serialver to populate this attribute and forget about it. I understand that if our application were managing the persistence of these objects, we would be interested in the version, because we would need to key off it for "upgrading" older persistent objects that are read by a newer version of software. None of that applies in this case, which is the source of confusion here, I'm pretty sure.
Hope this helps.

Similar Messages

  • How to change the java cup icon for all the JFrames?

    Hi,
    I would like to know if I can change the Java cup defult icon that appears in the upper left corner of the JFrames in one time, instead of setting the JFrame's icon in every created JFrame.
    Regards,
    Gabriel

    Then don't set the parent to null. If you don't want a parent, just set it to
    JOptionPane.showMessage(new IconFrame(), ...
    [\code]
    where IconFrame extends JFrame and sets the icon in it's constructor.  The optionpane will then use the icon from it's parent frame.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Changes in java file dont show up on site

    hi
    i'm using tomcat4 server.
    i use java jsp html files for developing the website.any changes to jsp files show up on refreshing the page but when i do changes in java files (which are called from jsp files) compile them and refresh the page the changes dont show up.
    even restarting the server didn't help.
    when i delete the .class file of that java code still the server runs when it is called from jsp file.
    it doesn't give filenotfound or classnotfound error which is expected in such case.
    can anybody plz tell me what to do

    Did you not overlook something, like putting a jar containing (previous versions of ) your classes to "lib" ?

  • Change the java program in *.exe

    how can i do to change my java program in a .exe file ? This could be useful if the user doesn't have the java runtime environment.

    Hello
    You can use third party softwares like
    PJ2Exe or sumthing like that
    search on google
    Rohan

  • Change the java cup picture in the top left corner

    Does any one knows how to change the java cup picture in the top left corner of the frames and applets
    Thanks in advance

    Hi,
    I have the following code added and get this error:
    non-static method setIconImage(java.awt.Image) cannot be referenced from a static context
    private static void SetUpGUIApplication(){
            //This must be invoked before
            //creating the JFrame.  Native look and feels will be set here
            // Comment this out to see the differences
           FrmMain.setDefaultLookAndFeelDecorated(true);
            ImageIcon appIcon = new ImageIcon(getClass().getResource("resources/FLGCAN.ICO"));
            if (appIcon != null)
                    setIconImage(appIcon.getImage());
        }What does this mean when adding static verses non static?
    Thanks

  • How to change the java control panel and the default java in windows.

    Hi,
    Please help on the above problem. I need the answer urgently.
    I have two java version 1.4 and 1.5. I first installed the java version 1.4.2_06 and then 1.5.0_19.Now the default java is 1.5.
    Now I want to chang the java settings to 1.4 by changing the envioronment variable (classpath,path,java_home)
    C:\Program Files\Java\jdk1.5.0_09;C:\j2sdk1.4.2_06
    C:\Program Files\Java\jdk1.5.0_09\lib;C:\j2sdk1.4.2_06\bin
    C:\Program Files\Java\jdk1.5.0_09\bin;C:\j2sdk1.4.2_06\bin
    But after setting these does not solve the problem. The java control panel which appears is the same what was appearing for java 1.5.
    I want to see the control panel for 1.4.2_06.
    Thanks for your help.
    Regards,
    Sarita

    sarita2320 wrote:
    ..Please help on the above problem. I need the answer urgently. ...Is it still urgent?
    When I opened your post and saw that line, I immediately moved it to the 'last in line' of a whole bunch of other stuff I did not have time to look at immediately. Now that all that other stuff that did not bore me with someone else's time constraints is out of the way/taken care of, I've returned to your post.

  • How can I block a site that keeps wanting to change my Java?

    I want to block a site that keeps coming up wanting to change my Java program from "Oracle" Java to something else. Is there a way to block specific sites in Firefox?
    I am running Windows 8.1 on a Toshiba laptop and have Firefox 25.0.1 Mozilla 26-1.0

    hello Nglover1941, you have various adware addons present - maybe one of them is causing the issue. please try these steps:
    # [[Reset Firefox – easily fix most problems|reset firefox]] (this wil keep your bookmarks and passwords)
    # afterwards go to firefox > addons > extensions and in case there are still extensions listed there, disable them.
    # finally run a full scan of your system with different security tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes] and [http://www.bleepingcomputer.com/download/adwcleaner/ adwcleaner] to make sure that adware isn't present in other places of your system as well.
    [[Troubleshoot Firefox issues caused by malware]]

  • Can U help me change "Paint.java" to MVC model

    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollBar;
    import javax.swing.JTextField;
    import javax.swing.ImageIcon;
    public class Paint extends Applet implements ActionListener, AdjustmentListener, MouseListener, MouseMotionListener
    private static final long serialVersionUID = 1L;
    private final int NO_OP = 0;
    private final int PEN_OP = 1;
    private final int LINE_OP = 2;
    private final int ERASER_OP = 3;
    private final int CLEAR_OP = 4;
    private final int RECT_OP = 5;
    private final int OVAL_OP = 6;
    private final int FRECT_OP = 7;
    private final int FOVAL_OP = 8;
    private final int SPLINE_OP = 9;
    private final int POLY_OP = 10;
    private int mousex = 0;
    private int mousey = 0;
    private int prevx = 0;
    private int prevy = 0;
    private boolean initialPen = true;
    private boolean initialLine = true;
    private boolean initialEraser = true;
    private boolean initialRect = true;
    private boolean initialOval = true;
    private boolean initialFRect = true;
    private boolean initialFOval = true;
    private boolean initialPolygon = true;
    private boolean initialSpline = true;
    private int Orx = 0;
    private int Ory = 0;
    private int OrWidth = 0;
    private int OrHeight = 0;
    private int drawX = 0;
    private int drawY = 0;
    private int eraserLength = 5;
    private int udefRedValue = 255;
    private int udefGreenValue = 255;
    private int udefBlueValue = 255;
    private int opStatus = PEN_OP;
    private int colorStatus = 1;
    private Color mainColor = new Color(0,0,0);
    private Color xorColor = new Color(255,255,255);
    private Color statusBarColor = new Color(166,166,255);
    private Color userDefinedColor = new Color(udefRedValue,udefGreenValue,udefBlueValue);
    private JButton penButton           = new JButton(new ImageIcon(getClass().getResource("pen.gif")));
    private JButton lineButton           = new JButton(new ImageIcon(getClass().getResource("line.gif")));
    private JButton eraserButton           = new JButton(new ImageIcon(getClass().getResource("eraser.gif")));
    private JButton clearButton = new JButton("Clear");
    private JButton rectButton           = new JButton(new ImageIcon(getClass().getResource("rec.gif")));
    private JButton ovalButton           = new JButton(new ImageIcon(getClass().getResource("oval.gif")));
    private JButton fillRectButton      = new JButton(new ImageIcon(getClass().getResource("fillrec.gif")));
    private JButton fillOvalButton      = new JButton(new ImageIcon(getClass().getResource("filloval.gif")));
    private JButton splineButton = new JButton("Spline");
    private JButton polygonButton = new JButton("Polygon");
    private JButton blackButton = new JButton("Black");
    private JButton blueButton = new JButton("Blue");
    private JButton redButton = new JButton("Red");
    private JButton greenButton = new JButton("Green");
    private JButton purpleButton = new JButton("Purple");
    private JButton orangeButton = new JButton("Orange");
    private JButton pinkButton = new JButton("Pink");
    private JButton grayButton = new JButton("Gray");
    private JButton yellowButton = new JButton("Yellow");
    private JButton userDefButton = new JButton("User-Def");
    private JScrollBar redSlider = new JScrollBar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
    private JScrollBar blueSlider = new JScrollBar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
    private JScrollBar greenSlider = new JScrollBar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
    private JTextField colorStatusBar = new JTextField(20);
    private JTextField opStatusBar = new JTextField(20);
    private JTextField mouseStatusBar = new JTextField(10);
    private JTextField redValue = new JTextField(3);
    private JTextField greenValue = new JTextField(3);
    private JTextField blueValue = new JTextField(3);
    private JLabel operationLabel = new JLabel(" Tool mode:");
    private JLabel colorLabel = new JLabel(" Color mode:");
    private JLabel cursorLabel = new JLabel(" Cursor:");
    private JPanel ToolbarPanel = new JPanel(new GridLayout(11,2,0,0));
    private JPanel drawPanel = new JPanel();
    private JPanel statusPanel = new JPanel();
    private JPanel udefcolPanel = new JPanel(new GridLayout(3,3,0,0));
    private JPanel udefdemcolPanel = new JPanel();
    private JPanel PicPanel               = new JPanel();
    public void init()
    setLayout(new BorderLayout());
    ToolbarPanel.add(blackButton);
    ToolbarPanel.add(blueButton);
    ToolbarPanel.add(redButton);
    ToolbarPanel.add(greenButton);
    ToolbarPanel.add(purpleButton);
    ToolbarPanel.add(orangeButton);
    ToolbarPanel.add(pinkButton);
    ToolbarPanel.add(grayButton);
    ToolbarPanel.add(yellowButton);
    ToolbarPanel.add(userDefButton);
    blueButton.setBackground(Color.blue);
    redButton.setBackground(Color.red);
    greenButton.setBackground(Color.green);
    purpleButton.setBackground(Color.magenta);
    orangeButton.setBackground(Color.orange);
    pinkButton.setBackground(Color.pink);
    grayButton.setBackground(Color.gray);
    yellowButton.setBackground(Color.yellow);
    userDefButton.setBackground(userDefinedColor);
    ToolbarPanel.add(penButton);
    ToolbarPanel.add(lineButton);
    ToolbarPanel.add(eraserButton);
    ToolbarPanel.add(clearButton);
    ToolbarPanel.add(rectButton);
    ToolbarPanel.add(ovalButton);
    ToolbarPanel.add(fillRectButton);
    ToolbarPanel.add(fillOvalButton);
    ToolbarPanel.add(splineButton);
    ToolbarPanel.add(polygonButton);
    ToolbarPanel.setBounds(0,0,100,300);
    ToolbarPanel.add(udefcolPanel);
    ToolbarPanel.add(udefdemcolPanel);
    udefcolPanel.add(redValue);
    udefcolPanel.add(redSlider);
    udefcolPanel.add(greenValue);
    udefcolPanel.add(greenSlider);
    udefcolPanel.add(blueValue);
    udefcolPanel.add(blueSlider);
    statusPanel.add(colorLabel);
    statusPanel.add(colorStatusBar);
    statusPanel.add(operationLabel);
    statusPanel.add(opStatusBar);
    statusPanel.add(cursorLabel);
    statusPanel.add(mouseStatusBar);
    colorStatusBar.setEditable(false);
    opStatusBar.setEditable(false);
    mouseStatusBar.setEditable(false);
    statusPanel.setBackground(statusBarColor);
    ToolbarPanel.setBackground(Color.white);
    drawPanel.setBackground(Color.white);
    add(statusPanel, "North");
    add(ToolbarPanel, "West");
    add(drawPanel, "Center");
    penButton.addActionListener(this);
    lineButton.addActionListener(this);
    eraserButton.addActionListener(this);
    clearButton.addActionListener(this);
    rectButton.addActionListener(this);
    ovalButton.addActionListener(this);
    fillRectButton.addActionListener(this);
    fillOvalButton.addActionListener(this);
    splineButton.addActionListener(this);
    polygonButton.addActionListener(this);
    blackButton.addActionListener(this);
    blueButton.addActionListener(this);
    redButton.addActionListener(this);
    greenButton.addActionListener(this);
    purpleButton.addActionListener(this);
    orangeButton.addActionListener(this);
    pinkButton.addActionListener(this);
    grayButton.addActionListener(this);
    yellowButton.addActionListener(this);
    userDefButton.addActionListener(this);
    redSlider.addAdjustmentListener(this);
    blueSlider.addAdjustmentListener(this);
    greenSlider.addAdjustmentListener(this);
    drawPanel.addMouseMotionListener(this);
    drawPanel.addMouseListener(this);
    // this.addMouseListener(this);
    // this.addMouseMotionListener(this);
    updateRGBValues();
    opStatusBar.setText("Pen");
    colorStatusBar.setText("Black");
    public void actionPerformed(ActionEvent e)
         penButton.setActionCommand("Pen");
         lineButton.setActionCommand("Line");
         eraserButton.setActionCommand("Eraser");
         rectButton.setActionCommand("Rectangle");
         ovalButton.setActionCommand("Oval");
         fillRectButton.setActionCommand("Filled Rectangle");
         fillOvalButton.setActionCommand("Filled Oval");
         if (e.getActionCommand() == "Pen")
         opStatus = PEN_OP;
         else if (e.getActionCommand() == "Line")
         opStatus = LINE_OP;
         else if (e.getActionCommand() == "Eraser")
         opStatus = ERASER_OP;
         else if (e.getActionCommand() == "Clear")
         opStatus = CLEAR_OP;
         else if (e.getActionCommand() == "Rectangle")
         opStatus = RECT_OP;
         else if (e.getActionCommand() == "Oval")
         opStatus = OVAL_OP;
         else if (e.getActionCommand() == "Filled Rectangle")
         opStatus = FRECT_OP;
         else if (e.getActionCommand() == "Filled Oval")
         opStatus = FOVAL_OP;
         else if (e.getActionCommand() == "Polygon")
         opStatus = POLY_OP;
         else if (e.getActionCommand() == "Spline")
         opStatus = SPLINE_OP;
         else if (e.getActionCommand() == "Black")
         colorStatus = 1;
         else if (e.getActionCommand() == "Blue")
         colorStatus = 2;
         else if (e.getActionCommand() == "Green")
         colorStatus = 3;
         else if (e.getActionCommand() == "Red")
         colorStatus = 4;
         else if (e.getActionCommand() == "Purple")
         colorStatus = 5;
         else if (e.getActionCommand() == "Orange")
         colorStatus = 6;
         else if (e.getActionCommand() == "Pink")
         colorStatus = 7;
         else if (e.getActionCommand() == "Gray")
         colorStatus = 8;
         else if (e.getActionCommand() == "Yellow")
         colorStatus = 9;
         else if (e.getActionCommand() == "User-Def")
         colorStatus = 10;
    initialPolygon = true;
    initialSpline = true;
    switch (opStatus)
    case PEN_OP : opStatusBar.setText("Pen");
    break;
    case LINE_OP : opStatusBar.setText("Line");
    break;
    case ERASER_OP: opStatusBar.setText("Eraser");
    break;
    case CLEAR_OP : clearPanel(drawPanel);
    break;
    case RECT_OP : opStatusBar.setText("Rectangle");
    break;
    case OVAL_OP : opStatusBar.setText("Oval");
    break;
    case FRECT_OP : opStatusBar.setText("Fill-Rectangle");
    break;
    case FOVAL_OP : opStatusBar.setText("Fill-Oval");
    break;
    case POLY_OP : opStatusBar.setText("Polygon");
    break;
    case SPLINE_OP: opStatusBar.setText("Spline");
    break;
    switch (colorStatus)
    case 1: colorStatusBar.setText("Black");
    break;
    case 2: colorStatusBar.setText("Blue");
    break;
    case 3: colorStatusBar.setText("Green");
    break;
    case 4: colorStatusBar.setText("Red");
    break;
    case 5: colorStatusBar.setText("Purple");
    break;
    case 6: colorStatusBar.setText("Orange");
    break;
    case 7: colorStatusBar.setText("Pink");
    break;
    case 8: colorStatusBar.setText("Gray");
    break;
    case 9: colorStatusBar.setText("Yellow");
    break;
    case 10: colorStatusBar.setText("User Defined Color");
    break;
    setMainColor();
    updateRGBValues();
    public void adjustmentValueChanged(AdjustmentEvent e)
    updateRGBValues();
    public void clearPanel(JPanel drawPanel2)
    opStatusBar.setText("Clear");
    Graphics g = drawPanel2.getGraphics();
    g.setColor(drawPanel2.getBackground());
    g.fillRect(0,0,drawPanel2.getBounds().width,drawPanel2.getBounds().height);
    public void penOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialPen)
    setGraphicalDefaults(e);
    initialPen = false;
    g.drawLine(prevx,prevy,mousex,mousey);
    if (mouseHasMoved(e))
    mousex = e.getX();
    mousey = e.getY();
    g.drawLine(prevx,prevy,mousex,mousey);
    prevx = mousex;
    prevy = mousey;
    public void lineOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialLine)
    setGraphicalDefaults(e);
    g.setXORMode(xorColor);
    g.drawLine(Orx,Ory,mousex,mousey);
    initialLine=false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawLine(Orx,Ory,mousex,mousey);
    mousex = e.getX();
    mousey = e.getY();
    g.drawLine(Orx,Ory,mousex,mousey);
    public void rectOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialRect)
    setGraphicalDefaults(e);
    initialRect = false;
    if (mouseHasMoved(e))
    g.setXORMode(drawPanel.getBackground());
    g.drawRect(drawX,drawY,OrWidth,OrHeight);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawRect(drawX,drawY,OrWidth,OrHeight);
    public void ovalOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialOval)
    setGraphicalDefaults(e);
    initialOval=false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    public void frectOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialFRect)
    setGraphicalDefaults(e);
    initialFRect=false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawRect(drawX,drawY,OrWidth-1,OrHeight-1);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawRect(drawX,drawY,OrWidth-1,OrHeight-1);
    public void fovalOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    if (initialFOval)
    setGraphicalDefaults(e);
    initialFOval = false;
    if (mouseHasMoved(e))
    g.setXORMode(xorColor);
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    mousex = e.getX();
    mousey = e.getY();
    setActualBoundry();
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    public void eraserOperation(MouseEvent e)
    Graphics g = drawPanel.getGraphics();
    if (initialEraser)
    setGraphicalDefaults(e);
    initialEraser = false;
    g.setColor(mainColor.white);
    g.fillRect(mousex-eraserLength, mousey-eraserLength,eraserLength*2,eraserLength*2);
    g.setColor(Color.black);
    g.drawRect(mousex-eraserLength,mousey-eraserLength,eraserLength*2,eraserLength*2);
    prevx = mousex;
    prevy = mousey;
    if (mouseHasMoved(e))
    g.setColor(mainColor.white);
    g.drawRect(prevx-eraserLength, prevy-eraserLength,eraserLength*2,eraserLength*2);
    mousex = e.getX();
    mousey = e.getY();
    g.setColor(mainColor.white);
    g.fillRect(mousex-eraserLength, mousey-eraserLength,eraserLength*2,eraserLength*2);
    g.setColor(Color.black);
    g.drawRect(mousex-eraserLength,mousey-eraserLength,eraserLength*2,eraserLength*2);
    prevx = mousex;
    prevy = mousey;
    public void polygonOperation(MouseEvent e)
    if (initialPolygon)
    prevx = e.getX();
    prevy = e.getY();
    initialPolygon = false;
    else
    mousex = e.getX();
    mousey = e.getY();
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawLine(prevx,prevy,mousex,mousey);
    prevx = mousex;
    prevy = mousey;
    public void splineOperation(MouseEvent e)
    if(initialSpline)
    initialSpline = false;
    public boolean mouseHasMoved(MouseEvent e)
    return (mousex != e.getX() || mousey != e.getY());
    public void setActualBoundry()
    if (mousex < Orx || mousey < Ory)
    if (mousex < Orx)
    OrWidth = Orx - mousex;
    drawX = Orx - OrWidth;
    else
    drawX = Orx;
    OrWidth = mousex - Orx;
    if (mousey < Ory)
    OrHeight = Ory - mousey;
    drawY = Ory - OrHeight;
    else
    drawY = Ory;
    OrHeight = mousey - Ory;
    else
    drawX = Orx;
    drawY = Ory;
    OrWidth = mousex - Orx;
    OrHeight = mousey - Ory;
    public void setGraphicalDefaults(MouseEvent e)
    mousex = e.getX();
    mousey = e.getY();
    prevx = e.getX();
    prevy = e.getY();
    Orx = e.getX();
    Ory = e.getY();
    drawX = e.getX();
    drawY = e.getY();
    OrWidth = 0;
    OrHeight = 0;
    public void mouseDragged(MouseEvent e)
    updateMouseCoordinates(e);
    switch (opStatus)
    case PEN_OP : penOperation(e);
    break;
    case LINE_OP : lineOperation(e);
    break;
    case RECT_OP : rectOperation(e);
    break;
    case OVAL_OP : ovalOperation(e);
    break;
    case FRECT_OP : frectOperation(e);
    break;
    case FOVAL_OP : fovalOperation(e);
    break;
    case ERASER_OP: eraserOperation(e);
    break;
    public void mouseReleased(MouseEvent e)
    updateMouseCoordinates(e);
    switch (opStatus)
    case PEN_OP : releasedPen();
    break;
    case LINE_OP : releasedLine();
    break;
    case RECT_OP : releasedRect();
    break;
    case OVAL_OP : releasedOval();
    break;
    case FRECT_OP : releasedFRect();
    break;
    case FOVAL_OP : releasedFOval();
    break;
    case ERASER_OP : releasedEraser();
    break;
    public void mouseEntered(MouseEvent e)
    updateMouseCoordinates(e);
    public void setMainColor()
    switch (colorStatus)
    case 1 : mainColor = Color.black;
    break;
    case 2: mainColor = Color.blue;
    break;
    case 3: mainColor = Color.green;
    break;
    case 4: mainColor = Color.red;
    break;
    case 5: mainColor = Color.magenta;
    break;
    case 6: mainColor = Color.orange;
    break;
    case 7: mainColor = Color.pink;
    break;
    case 8: mainColor = Color.gray;
    break;
    case 9: mainColor = Color.yellow;
    break;
    case 10: mainColor = userDefinedColor;
    break;
    public void releasedPen()
    initialPen = true;
    public void releasedLine()
    if ((Math.abs(Orx-mousex)+Math.abs(Ory-mousey)) != 0)
    // System.out.println("Line has been released....");
    initialLine = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawLine(Orx,Ory,mousex,mousey);
    public void releasedEraser()
    initialEraser = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor.white);
    g.drawRect(mousex-eraserLength,mousey-eraserLength,eraserLength*2,eraserLength*2);
    public void releasedRect()
    initialRect = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawRect(drawX,drawY,OrWidth,OrHeight);
    public void releasedOval()
    initialOval = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.drawOval(drawX,drawY,OrWidth,OrHeight);
    public void releasedFRect()
    initialFRect = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.fillRect(drawX,drawY,OrWidth,OrHeight);
    public void releasedFOval()
    initialFOval = true;
    Graphics g = drawPanel.getGraphics();
    g.setColor(mainColor);
    g.fillOval(drawX,drawY,OrWidth,OrHeight);
    public void updateMouseCoordinates(MouseEvent e)
    String xCoor ="";
    String yCoor ="";
    if (e.getX() < 0) xCoor = "0";
    else
    xCoor = String.valueOf(e.getX());
    if (e.getY() < 0) xCoor = "0";
    else
    yCoor = String.valueOf(e.getY());
    mouseStatusBar.setText("x:"+xCoor+" y:"+yCoor);
    public void updateRGBValues()
    udefRedValue = redSlider.getValue();
    udefGreenValue = greenSlider.getValue();
    udefBlueValue = blueSlider.getValue();
    if (udefRedValue > 255)
    udefRedValue = 255;
    if (udefRedValue < 0 )
    udefRedValue =0;
    if (udefGreenValue > 255)
    udefGreenValue = 255;
    if (udefGreenValue < 0 )
    udefGreenValue =0;
    if (udefBlueValue > 255)
    udefBlueValue = 255;
    if (udefBlueValue < 0 )
    udefBlueValue =0;
    redValue.setText(String.valueOf(udefRedValue));
    greenValue.setText(String.valueOf(udefGreenValue));
    blueValue.setText(String.valueOf(udefBlueValue));
    userDefinedColor = new Color(udefRedValue,udefGreenValue,udefBlueValue);
    userDefButton.setBackground(userDefinedColor);
    Graphics g = udefdemcolPanel.getGraphics();
    g.setColor(userDefinedColor);
    g.fillRect(0,0,800,800);
    public void mouseClicked(MouseEvent e)
    updateMouseCoordinates(e);
    switch (opStatus)
    case 9 : splineOperation(e);
    break;
    case 10 : polygonOperation(e);
    break;
    public void mouseExited(MouseEvent e)
    updateMouseCoordinates(e);
    public void mouseMoved(MouseEvent e)
    updateMouseCoordinates(e);
    public void mousePressed(MouseEvent e)
    updateMouseCoordinates(e);
    Edited by: eclipse on Feb 19, 2008 6:29 AM

    If you can't divide the class then you can't implement an MVC design methodology.
    This class is a giant mess and can be EASILY broken down into smaller classes. Seperate the visual components into their own classes. Create Model objects that contain the data behind your visual components.
    Split up your giant ActionListener into several smaller more specialized actionlisteners and create a Controller object that you can assign these listeners and models to. Allow the event handling to be done by the controller so it can propogate necessary data changes to the models, thus altering the Views.
    Thats it in a nutshell. It is not an easy answer.

  • Is there any way to prevent web.xml from any change like java class?

    hi all,
    Is there any way to prevent web.xml from any change after making EAR(WAR)?
    One can easily make a change in web.xml and redeploy the application to get the result. Now we want to restrict the web.xml as java class for any change after making EAR(or WAR).
    Could some one help me to do this?
    thanks,
    dinesh

    hi,
    Not at development level. We want it after deploying the application on server .
    We want to create it (web.xml) at tomcat startup (or in any other web/app server ) before loading any context.
    Is there any way to run a simple java class(not servlet) on tomcat startup(before initializing the contexts)?
    Message was edited by:
    DP_java
    Message was edited by:
    DP_java

  • How do you change default java logo in JOptionPane?

    I want to know how do you change the icon(the java logo in the title bar) for the JOptionPane box. I am using a swing interface. I can change the icon of the main frame but not of the JOptionPane.
    for the main frame i have used:
         Toolkit kit = Toolkit.getDefaultToolkit();
         Image img = kit.getImage("mypicture.gif");
         setIconImage(img);
    Toolkit is part of java.awt package.
    thanks

    here was a discussions about that
    http://forum.java.sun.com/thread.jsp?thread=120724&forum=57&message=316526

  • Conversion Error in JCO due to BigDecimal.toString() change in Java 1.5

    Hi folks,
    we have a problem here. A field which is set through a java.math.BigDecimal(0) gets very funny values in JCo. We had a look insight JCo und found, that JCo.Record does the following with BigDecimals:
    if ((value instanceof BigDecimal) && itype == 2)
       try
         BigDecimal bd=(BigDecimal) value;
         bd=bd.setScale(super.decimals[index], 6);
         encodeBCD(bd.toString(), index);
       catch (Exception ex)
         throw new ConversionException(ex.getMessage());
    A value of 0 (and super.decimals[index]==7) is than translatet not to "0.0000000" but to "0E-7". This is a big difference to what JDK 1.4 used to print and encodeBCD fails with "0E-7". JCo with JDK 1.5 should use "toPlainString()" now at this place (or adopt encodeBDC), but that would not be downward compatible anymore...
    OK, we solved this issu for now by transforming to a string ourself at a central point befor using "setValue" in JCo. The other way would be to use XML for all settings. But that would mean a change of the whole software.
    Does anybody of you know of a different solution we could use? Or will there be a new JCo Version solving this?
    Thanks
    PS: try this code. It will make all clear to you:
    BigDecimal bd = new BigDecimal(0);
    BigDecimal bd1 = bd.setScale(7, BigDecimal.ROUND_HALF_EVEN);
    BigDecimal bd2 = bd.setScale(6, BigDecimal.ROUND_HALF_EVEN);
    System.out.println(bd.toString()+"=="+bd.toPlainString());
    System.out.println(bd1.toString()+"!="+bd1.toPlainString());
    System.out.println(bd2.toString()+"=="+bd2.toPlainString());
    Result is:
    0==0
    0E-7!=0.0000000
    0.000000==0.000000
    Message was edited by: Daniel Becker

    user712747 wrote:
    When we are converting string to BigDecimal, in JAVA 1.5 it is post fixing with extra “0”(zero) if the string value ends with single “ ”0” (zero).That sounds very odd.
    To overcome this we can use toPlainString() method in Java 1.5. But it is not feasible to make this change all over places in our code.Aha! This sounds like conversion from BigDecimal to String; not what you described above. And I have to admit, that change mystified me too, because it goes against the grain of backwards-compatibility. It's possible that it was meant to "standardize" output for floating-point values though.
    Is there any fix available?Well, one thing might be to use toPlainString() in the places where you're having problems. The string produced by toString() is still suitable for converting back to BigIntegers (and will do so precisely; I believe the toPlainString() style could produce a BigDecimal with the same value but different scale), so unless you actually need the string for viewing you can leave it alone.
    But as EJP says, post some code.
    Winston

  • How to make changes to Java for Lion

    Forgive me, I am not experienced with Java Applets or the website I am mentioning in this post. I am asking for another person and have only been able to run tests and theories this evening.
    It seems that the most recent Java upgrade has caused some issues with runescape.com Several Mac users at the site are reporting the same issue. When attempting to log into runescape an applet requests permission to access the computer. Actually, the warning window pops open and closed so quickly I have not been able to capture the text in it. Next, a Java Applet opens in the Dock and another warning/certificate window opens where the user can choose to Deny or Accept the certificte. Prior to the update the applet was handled within Safari. Apparently there were no additional steps to logging in. I recognize that Lion does not provide a Java runtime by default so I am wondering if changing that setting would enable runtime to do its thing without having to go through several approvals. The Java Applet runs anywhere from 28% to 100% (and sometimes more—I don't undestand that) of the CPU.
    Alas, this is still not the main issue at play. Apparently the applet causes the application/website to respond v-e-r-y s-l-o-w-l-y Is there a way to achieve the same speeds that were available prior to the update? Ideas that I have been floating have been to downgrade from the present Lion/Java combination to Snow Leopard and the penultimate version of Java (next question: where can update 5 be downloaded). I have tried to install previous versions of Java but none are available for the Lion OS. Another option is to deny the applet and the user is taken to an alternate login page. The page loads the applet in Safari but there are severe limitations to the game (reported to me—I have no basis to compare). So what the user gets in speed is limited by the fact that they can only play in "one world".
    In summary, my questions are this:
    Does someone have a workaround for the Java Applet slowdown for this game, Runescape?
    Is there a downgrade option available for Java in Lion? (my searching has not found one)
    Is there a way to change the default runtime setting? (I have read at least one post where the user tried to edit settings in Java Preferences and they did not stick but they might not have restarted their browser)

    Hi,
    ITS i dont have an idea but from portal we can do CTRL+RIGHT CLICK AND WE CAN HIDE THE FIELD.
    Try the same in ITS in the iview out put.
    Thre are some tables where we can hide some fields for old ESS/MSS packages.
    Try that.
    If we are using portal we can go for NWDI ALSO.
    Thanks,
    GOPAL

  • How can i change my JAVA card life cycle state to OP_READY?

    I found the below script in this link and run it via `GPShell` on my java card and now I can't run `gpj -list` in `GPJ`!
    My questions:
    1- What is this code for? changing Card Domain Manager status from OP_READY to Secured?
    2- Why I can't find anywhere `80F0800708A000000003000000` And `80F0800F08A000000003000000` APDUs that used in script?! I searched `GP Specification 2.2` and `ISO 7814-4` for an APDU with `F0` in `CLA` section! But I found nothing!
    3- Is the operation of the below script reversible by another script?
    The Script :
        mode_211
        enable_trace
        establish_context
        card_connect
        select -AID A0000000
        open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key
        404142434445464748494a4b4c4d4e4f
        send_apdu -sc 1 -APDU 80F0800708A000000003000000
        send_apdu -sc 1 -APDU 80F0800F08A000000003000000
        card_disconnect
        release_context
    And this is it's output in Console :
        C:\Users\ghasemi\Desktop\GPShell-1.4.4>gpshell lcchange.txt
        mode_211
        enable_trace
        establish_context
        card_connect
        select -AID a00000
        Command --> 00A4040003A00000
        Wrapped command --> 00A4040003A00000
        Response <-- 6F108408A000000003000000A5049F6501FF9000
        open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4
        f -enc_key 404142434445464748494a4b4c4d4e4f -kek_key 404142434445464748494a4b4c4
        d4e4f
        Command --> 80CA006600
        Wrapped command --> 80CA006600
        Response <-- 664C734A06072A864886FC6B01600C060A2A864886FC6B02020101630906072A864
        886FC6B03640B06092A864886FC6B040215650B06092B8510864864020103660C060A2B060104012
        A026E01029000
        Command --> 805000000823CE2F4C2B6C689B00
        Wrapped command --> 805000000823CE2F4C2B6C689B00
        Response <-- 0000116001007F8B0AF9020201D1C94E4F787D75DD54805A7488BCF79000
        Command --> 84820100100BCCFE8818D2DFC6E5B48EA4B6892457
        Wrapped command --> 84820100100BCCFE8818D2DFC6E5B48EA4B6892457
        Response <-- 9000
        send_apdu -sc 1 -APDU 80F0800708A000000003000000
        Command --> 80F0800708A000000003000000
        Wrapped command --> 84F0800710A0000000030000007AA29B3A708E6E75
        Response <-- 9000
        send_APDU() returns 0x80209000 (9000: Success. No error.)
        send_apdu -sc 1 -APDU 80F0800F08A000000003000000
        Command --> 80F0800F08A000000003000000
        Wrapped command --> 84F0800F10A0000000030000004FCFC15FD7EBDE9A
        Response <-- 9000
        send_APDU() returns 0x80209000 (9000: Success. No error.)
        card_disconnect
        release_context
    Thankyou.

    Hi,
    Ad.1
    Yes, this script is dedicated to change ISD state from OP_READY to SECURED (cards compatible with GP 2.1.1 specs).
    Ad.2
    The script commands are constructed basing on GP 2.1.1 specs. As far as I know, the definition of SET STATUS command in GP 2.2 is the same as in GP 2.1.1 specs.
    Ad. 3
    The change of state from SECURED to OP_READY is irreversible. Sorry.
    Regards

  • JBO-25014: Another user has changed .... can I change myViewRowImpl.java???

    Hi all,
    I'm noob working with jDeveloper and ADF and i'm finding a lot of problems building my application. The first one: "JBO-25014: Another user has changed .."
    I have been reading a lot about this problem and its different causes but seems that nothing helps me so i'm gonna tell you my problem and i hope that someone know how to solve it.
    My page shows a table and below it the details of each row selected in the table in read only mode.
    The table shows fields from a table in database and other fields with information not located in database (CMS). To build it i used the wizard to create a bussines component from a table . After i added the properties that are not located in database to the view and entity object.
    I generated java code for the view (myViewImpl.java & myViewRowImpl.java) and for the aplicacion module (myAmImpl.java) and in java class for the application module I overwrote some methods (findViewObject & getViewObjects) to add the source code needed to get data from CMS and add it to the data obtained from database.
    That works perfecly!
    Now, I wrote a new method in myViewImpl.java which get data from details form and update table in database (moreover other task: send mail, sms....). This method is executed with a command button. Method commits transaction after each operation. Again this works perfectly!
    The problem comes when i try to refresh the table with the new data after update. I tried different solutions:
    - Option 1: Clear cache after commit. Problem: When table is reloaded I'm losing data obteined from CMS and also this process is too heavy, i would like to avoid to go to CMS to reload whole table with every update of a row.
    - Option 2: Set new values directly in object myViewRowImpl.java. That could be the perfect solution, after every update i just inform the row object with the new values. The problem is that when i try to commit the transaction I'm getting a JBO-25014. If I set the new values before commit, the errors comes in this commit, if i set the values after the commit, the error comes in the next row to be updated.
    Any idea of how to avoid the problem in option 2????
    Other general sugestion????
    Thanks in advance!!
    Curro.
    PD: Sorry for my poor english

    Hi,
    Using ADF BC, the default locking behavior is set to pessimistic. Check the ApplicationModule configuration (right mouse click the AM and choose "configuration") and change the locking property to optimistic.
    Also you need to set the EO attributes to refresh after insert and/or refresh after update.
    ~Abhijit

  • Meter changes in Java MIDI

    I am writing a program that creates a midi file as output. This midifile can then be loaded into a sequencer and viewed as music notation.
    The problem is that would like to know how to implement a meter change (ie time signature)
    Can someone send me an example of some code that does this? I've ready the Sun java reference page extensively as well as many many other web pages, and all stop short of this topic.
    Thanks

    Here's the code I ended up using for creating and reading tempo change and time signature change messages. Note that Java doesn't support unsigned bytes, so when reading the value you have to check the sign before converting to int. Also, I haven't tested this with any outside equipment, just my own software synth.
    code:
        final int TEMPO_MESSAGE = 0x51;
        MetaMessage tempoChangeMessage(int bpm) // bpm==beats per minute
             long mpq=60000000 / bpm; // mpq==microsec per quarter (beat)
             byte[] data = new byte[3];
             data[0] = (byte)((mpq >> 16) & 0xFF);
             data[1] = (byte)((mpq >> 8) & 0xFF);
             data[2] = (byte)(mpq & 0xFF);
             MetaMessage m = new MetaMessage();
             try
                  m.setMessage(TEMPO_MESSAGE, data, data.length);
             catch (InvalidMidiDataException e)
             return m;
        boolean isTempoChangeMessage(MidiMessage m)
             if (!(m instanceof MetaMessage))
                  return false;
             return ((MetaMessage)m).getType() == TEMPO_MESSAGE;
        // returns beats (quarter notes) per minute
        int getTempoFromMessage(MetaMessage m)
             byte[] byteData = m.getData();
             int[] intData = new int[3];
             // fix for lack of unsigned byte type
             for (int i=0 ; i<3 ; ++i)
                  if (byteData[i] < 0)
                       intData[i] = byteData[i] + 256;
                  else
                       intData[i] = byteData;
         long mpq=(intData[0] << 16) + (intData[1] << 8) + (intData[2]);
         return (mpq == 0 ? 1 : (int)(60000000 / mpq));
    // denominator = 2 ^ denominatorExponent, eg 6, 3 gives 6/8 time
    final int TIME_SIGNATURE_MESSAGE = 0x58;
    MetaMessage timeSignatureChangeMessage(int numerator, int denominatorExponent)
         byte[] data = new byte[4];
         data[0] = (new Integer(numerator)).byteValue();
         data[1] = (new Integer(denominatorExponent)).byteValue();
         data[2] = (new Integer(24)).byteValue(); // ignoring this
         data[3] = (new Integer(8)).byteValue(); // ignoring this
         MetaMessage m = new MetaMessage();
         try
              m.setMessage(TIME_SIGNATURE_MESSAGE, data, data.length);
         catch (InvalidMidiDataException e)
              // oh well...
         return m;
    boolean isTimeSignatureChangeMessage(MidiMessage m)
         if (!(m instanceof MetaMessage))
              return false;
         return ((MetaMessage)m).getType() == TIME_SIGNATURE_MESSAGE;      
    // returns numerator, assume 1/4 notes so ignore denominator exponent etc
    int getTimeSignatureFromMessage(MetaMessage m)
         byte[] data = m.getData();
         return data[0];
    int quarterNotesPerBar=getTimeSignatureFromMessage(m);

Maybe you are looking for

  • Validating records into a maintenance view

    Hi folks! I have a simple Z table (say ZTABLE) and a Z view based on it with some related description (say ZVIEW).  The ZTABLE has a DEC field (called COEF) with 2 decimals and it should have only numbers between 0 and 1. I set the valid interval fro

  • Site not showing responsively on mobile (viewport tag help?)

    I'm new to responsive design so bear with me... My site works responsively when I change the size of the browser window on a desktop, but on mobile it appears as a zoomed-out version. I tried several versions of the viewport meta tag to try and solve

  • File Sharing OSX with Win 2000 & XP

    Hi, I have an existing MS Windows network that works fine and has a LinkSys Router and Switch. I am attempting to connect my G4 PB via Ethernet but have trouble mounting the Win volume. I can see, and transfer files, to the G4 via Win Networking but

  • Logic 7.1.1

    I know it's old but till now has worked great. I need to know how to assign more memory to the program. Is that possible? I'm working on a project and when I try to save it says "out of memory". Help

  • Problem with Delta IP on 0TCT_DS23 in Production system

    Hi all, I'm encountering a quite tricky problem: I'm currently working on the 0TCT_DS23 Datasource, with the technical content cube. I can run an init infopackage on our 3 environments, Dev, Quality and production. Same for full packages. But when I