Applet not repainting

Here is the problem. I call the Histogram class in my applet paint method and it painted what was in my Histogram class just fine. But now that I have added a few things to get the MouseListener to work so I can click on some of the graphics, my graphics just flash up really quick and then disappear. Here is my MyApplet2 paint method code and my Histogram class.
public void paint(Graphics g)
          System.out.println("We are in paint ");
          Dimension d = getSize();
          w = d.width;
          h = d.height;
          if(graph_type == "Histogram") {
               hist = new Histogram this,options,adata,bindata,g,w,h,group_array);
THESE WERE ADDED CAUSING THE PROBLEM//hist.addMouseListener(hist);
THESE WERE ADDED CAUSING THE PROBLEM//hist.setSize(w,h);
THESE WERE ADDED CAUSING THE PROBLEM//add(hist);
          validate();
          System.out.println("We are out of paint with a width of " + w + " and a     height of " + h);
import java.awt.*;
import java.text.*;
import java.awt.event.*;
class Histogram extends Panel implements MouseListener{
MyApplet2 applet;
Histogram(MyApplet2 parent,String[] options, String[][] data, int[][] bin, Graphics gc,int w, int h,String[] group_array) {
int color [][] = {{0,0,255},{255,255,128},{0,255,128},{0,128,255},{255,128,192},
{255,0,0},{255,255,0},{128,255,0},{0,255,255},{0,128,192},{128,128,192},{255,0,255},{128,64,64},
{255,128,64},{0,128,128},{128,128,255},{255,0,128},{128,0,0},{0,128,0},{0,0,160},{128,0,128},
{128,0,255},{0,64,0},{64,0,128},{0,0,0},{128,128,0},{128,128,128},{214,228,154},{185,255,185}};
applet = parent;
     System.out.println("We are in Histogram");
          int width = w-218;
          int height = h-23;
          int x_start = width/15;
          int y_start = height/20;
          int x_end = (width-2*(width/10));
          int y_end = (height-2*(height/15));
          int binwidth;
          int max = (int)Float.valueOf(options[4]).floatValue();
          int min = (int)Float.valueOf(options[3]).floatValue();
          binwidth = (x_end/bin[0].length);
//////////////////Drawing the background of the graph//////////////////////
          gc.setColor(Color.white);
          gc.fillRect(1,1,width,height);
          gc.setColor(Color.lightGray);
          gc.fillRect(x_start,y_start,binwidth*bin[0].length,y_end);
          gc.setColor(Color.black);
          gc.drawRect(x_start,y_start,binwidth*bin[0].length,y_end);
          gc.setColor(Color.black);
//////////////////Getting the size of the x-axis font//////////////////////
          int string_width;
          int x_font_size = 10,title_font_size = 12;
          Font f = new Font("SansSerif", Font.PLAIN, x_font_size);
          FontMetrics fm = gc.getFontMetrics(f);
          DecimalFormat df = new DecimalFormat("#######0.##");
          string_width = fm.stringWidth(String.valueOf(options[1]));
          while(string_width > binwidth && x_font_size != 0){
                    x_font_size--;
                    f = new Font("SansSerif", Font.PLAIN, x_font_size);
                    fm = gc.getFontMetrics(f);
                    string_width = fm.stringWidth(options[1]);
//////////////////Drawing the bars//////////////////////               
          for(int b = 0; b < bin.length; b++){
          draw_bin(gc,b,options,bin,x_start,y_start,x_end,y_end,binwidth,min,max,string_width,height,x_font_size,color);
     //////last x_axis_value/////
          gc.drawLine(binwidth*bin[0].length+x_start,y_start+y_end,binwidth*bin[0].length+x_start,(y_end+y_start+(height-(y_end+y_start))/4));
          string_width = fm.stringWidth(String.valueOf(Float.valueOf(options[1]).floatValue()));                                        
          gc.drawString(df.format((Float.valueOf(options[1]).floatValue())),((binwidth*bin[0].length)-(string_width/3))+x_start,(y_end+y_start+(height-(y_end+y_start))/2));
     //////graph title/////
          gc.setFont(new Font("SansSerif", Font.PLAIN, title_font_size));
          f = new Font("SansSerif", Font.PLAIN, title_font_size);
          fm = gc.getFontMetrics(f);
          gc.drawString("Histogram",(x_start+x_end)/2-fm.stringWidth("Histogram")/2,y_start/2);
          gc.drawString(options[6],(x_start+x_end)/2-fm.stringWidth(options[6])/2,y_start+y_end+(height-(y_start+y_end))/1);
     ////draw y_axis////
          draw_yaxis(gc,x_start,y_start,x_end,y_end,max,min,bin[0]);     
          draw_legend(gc,x_start,y_start,x_end,y_end,height,width,group_array,color);     
          addMouseListener(this);
          System.out.println("hello");
          //addActionListener(this);
          //validate();
          System.out.println("We are out of Histogram ");
public void mouseClicked(MouseEvent e) {
     /*if(e.getClickCount() == 2){  
     System.out.println("X = "+ e.getX());
     System.out.println("X = "+ e.getX());
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mousePressed(MouseEvent e){}
I've been stuck on this all day...

Here's a repost so that I can read the code.
public void paint(Graphics g)
System.out.println("We are in paint ");
Dimension d = getSize();
w = d.width;
h = d.height;
if(graph_type == "Histogram") {
hist = new Histogram(this,options,adata,bindata,g,w,h,group_array);
//THESE WERE ADDED CAUSING THE PROBLEM
hist.addMouseListener(hist);
hist.setSize(w,h);
add(hist);
validate();
System.out.println("We are out of paint with a width of " + w + " and a height of " + h);
import java.awt.*;
import java.text.*;
import java.awt.event.*;
class Histogram extends Panel implements MouseListener
MyApplet2 applet;
Histogram(MyApplet2 parent,String[] options, String[][] data, int[][] bin, Graphics gc,int w, int h,String[] group_array)
int color [][] = {
{0,0,255},{255,255,128},{0,255,128},{0,128,255},              {255,128,192},{255,0,0},{255,255,0},{128,255,0},
              {0,255,255},{0,128,192},{128,128,192},{255,0,255},
              {128,64,64},{255,128,64},{0,128,128},{128,128,255},
              {255,0,128},{128,0,0},{0,128,0},{0,0,160},{128,0,128},
              {128,0,255},{0,64,0},{64,0,128},{0,0,0},{128,128,0},
              {128,128,128},{214,228,154},{185,255,185}
applet = parent;
System.out.println("We are in Histogram");
int width = w-218;
int height = h-23;
int x_start = width/15;
int y_start = height/20;
int x_end = (width-2*(width/10));
int y_end = (height-2*(height/15));
int binwidth;
int max = (int)Float.valueOf(options[4]).floatValue();
int min = (int)Float.valueOf(options[3]).floatValue();
binwidth = (x_end/bin[0].length);
//////////////////Drawing the background of the graph//////////////////////
gc.setColor(Color.white);
gc.fillRect(1,1,width,height);
gc.setColor(Color.lightGray);
gc.fillRect(x_start,y_start,binwidth*bin[0].length,y_end);
gc.setColor(Color.black);
gc.drawRect(x_start,y_start,binwidth*bin[0].length,y_end);
gc.setColor(Color.black);
//////////////////Getting the size of the x-axis font//////////////////////
int string_width;
int x_font_size = 10,title_font_size = 12;
Font f = new Font("SansSerif", Font.PLAIN, x_font_size);
FontMetrics fm = gc.getFontMetrics(f);
DecimalFormat df = new DecimalFormat("#######0.##");
string_width = fm.stringWidth(String.valueOf(options[1]));
while(string_width > binwidth && x_font_size != 0){
x_font_size--;
f = new Font("SansSerif", Font.PLAIN, x_font_size);
fm = gc.getFontMetrics(f);
string_width = fm.stringWidth(options[1]);
//////////////////Drawing the bars//////////////////////               
for(int b = 0; b < bin.length; b++){
draw_bin(gc,b,options,bin,x_start,y_start,x_end,y_end,binwidth,min,max,string_width,height,x_font_size,color);
//////last x_axis_value/////
gc.drawLine(binwidth*bin[0].length+x_start,y_start+y_end,binwidth*bin[0].length+x_start,y_end+y_start+(height-(y_end+y_start))/4));
string_width = fm.stringWidth(String.valueOf(Float.valueOf(options[1]).floatValue()));
gc.drawString(df.format((Float.valueOf(options[1]).floatValue())),((binwidth*bin[0].length)-(string_width/3)),x_start,(y_end+y_start+(height-(y_end+y_start))/2));
//////graph title/////
gc.setFont(new Font("SansSerif", Font.PLAIN, title_font_size));
f = new Font("SansSerif", Font.PLAIN, title_font_size);
fm = gc.getFontMetrics(f);
gc.drawString("Histogram",(x_start+x_end)/2-fm.stringWidth("Histogram")/2,y_start/2);
gc.drawString(options[6],(x_start+x_end)/2-fm.stringWidth(options[6])/2,y_start+y_end+(height-(y_start+y_end))/1);
////draw y_axis////
draw_yaxis(gc,x_start,y_start,x_end,y_end,max,min,bin[0]);     
draw_legend(gc,x_start,y_start,x_end,y_end,height,width,group_array,color);     
addMouseListener(this);
System.out.println("hello");
//addActionListener(this);
//validate();
System.out.println("We are out of Histogram ");
public void mouseClicked(MouseEvent e)
/*if(e.getClickCount() == 2){  
System.out.println("X = "+ e.getX());
System.out.println("X = "+ e.getX());
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mousePressed(MouseEvent e){}
}

Similar Messages

  • Preventing applet from repainting/refreshing on resize

    hi,
    anyone has any idea on how one can prevent an applet from repainting the GUI screen when the applet is resized (minimized, maximized etc). i have a chat applet, but whenever the applet is minimized, all the present chat transcripts are lost and a new/refreshed window is displayed. how can we prevent this from happening? in effect, i want my applet to be displayed in the same state as it was before it was minimized.
    is there something i am missing?
    thanks,
    Satyen

    hi all,
    is this doubt really difficult, or i am missing something so very obvious, that no one out there wants to point it out.
    any suggestions would be very helping. and please, i am not looking for code snippets, any pointers/suggestions to the solution of the problem would suffice.
    thanks,
    Satyen.

  • Can you repaint certain elements (ie a ball) while NOT repainting the board

    I'm really just starting out writing java applets. I don't use Applet, i use JApplet because the coding is much more familiar. I understand that this might be a bad decision and if it is, please tell me! Anyway, my question is: Can I have the paint method (called via repaint()) paint the board one time, then only repaint the ball and it's constant change in position? I want to do this because the only way I can think of to have constant motion of the ball (I'm trying to simulate Pong) is by adding repaint() to the end of the paint function. This causes the applet to repaint very rapidly and everything gets all cut up and looks like crap. Any ideas on how I can make it run smoother? my code is teh following, if it helps (I realize that it isn't really commented, I am very messy and I do apologize):
    import java.util.Random;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Date;
    public class NewProj extends JApplet implements ActionListener, MouseListener, MouseMotionListener, KeyListener{
    /** Creates a new instance of NewProj */
    private int xBar1,yBar1,xBar2,yBar2;
    private String code;
    private int bar1H, bar2H, yMovement, xMovement;
    private int frame;
    private int ballX,ballY;
    private boolean hitTop,hitBottom,hitLeft,hitRight,hitPaddle1,hitPaddle2;
    private int score1,score2;
    private Date date;
    public NewProj() {
    date = new Date();
    score1=0;
    score2=0;
    ballX=175;
    ballY=125;
    yMovement=ballY+3;
    xMovement=ballX+3;
    frame=0;
    bar1H=40;
    bar2H=40;
    code="";
    xBar1=30;
    yBar1=130;
    xBar2=320;
    yBar2=130;
    this.addMouseMotionListener(this);
    this.addMouseListener(this);
    this.addKeyListener(this);
    public void paint(Graphics g){
    super.paint(g);
    g.drawString("Score: "+score1,220,20);
    g.drawString("Score: " + score2,80,20);
    if(frame==25){
    //initiate a and xMovement as moving linearly with a slope of 1.
    yMovement=ballY+3;
    xMovement=ballX+3;
    if(ballX<=xBar1+8 && ballX>=xBar1 && ballY<=yBar1+bar1H && ballY>=yBar1){
    hitPaddle1=true;
    hitPaddle2=false;
    hitRight=false;
    hitLeft=false;
    if(ballX<=xBar2+8 && ballX>=xBar2 && ballY<=yBar2+bar2H && ballY>=yBar2){
    hitPaddle2=true;
    hitRight=false;
    hitLeft=false;
    //check if the ball hit the Top
    if(ballY<1){
    hitBottom=false;
    hitTop=true;
    if(ballY>250){
    hitTop=false;
    hitBottom=true;
    if(ballX<10){
    hitPaddle2=false;
    hitPaddle1=false;
    hitRight=false;
    hitLeft=true;
    score1++;
    if(ballX>350){
    hitPaddle2=false;
    hitPaddle1=false;
    hitLeft=false;
    hitRight=true;
    score2++;
    if(hitBottom){
    yMovement=ballY-3;
    if(hitTop){
    yMovement=ballY+3;
    if(hitLeft){
    xMovement=ballX+3;
    if(hitRight)
    xMovement=ballX-3;
    if(hitPaddle1){
    xMovement=ballX+3;
    if(hitPaddle2){
    xMovement=ballX-3;
    System.out.println(yMovement+" is yMovement " + "and" + xMovement + " is xmove");
    ballY=yMovement;
    ballX=xMovement;
    frame=0;
    repaint();
    if(code.equals("penis")){
    if(bar1H>=60)
    bar1H=60;
    else bar1H+=5;
    code="";
    //top & bottom
    g.drawLine(0,0,350, 0);
    g.drawLine(0,250,350,250);
    //left & right sides
    g.drawLine(0,0,0,250);
    g.drawLine(350,0,350,250);
    //Midline
    g.drawLine(175,0,175,250);
    //ball
    g.setColor(Color.MAGENTA);
    g.fillOval(ballX,ballY,8,8);
    g.setColor(Color.RED);
    g.fillRect(xBar1,yBar1,5,bar1H);
    g.setColor(Color.BLUE);
    g.fillRect(xBar2,yBar2,5,bar2H);
    frame++;
    for(int b = 0; b<1000;b++){
    int hilbo=b+3;
    repaint();
    public void mouseClicked(MouseEvent e) {
    public void mouseEntered(MouseEvent e) {
    repaint();
    public void mouseExited(MouseEvent e) {
    public void mousePressed(MouseEvent e) {
    public void mouseReleased(MouseEvent e) {
    public void actionPerformed(ActionEvent e) {
    public void mouseDragged(MouseEvent e) {
    public void mouseMoved(MouseEvent e) {
    int y = e.getY();
    if(y<=(250-bar1H))
    yBar1 = y-(int)bar1H/2;
    else yBar1 = 250-bar1H;
    public void keyPressed(KeyEvent e) {
    if(e.getKeyCode()==40){
    yBar2+=10;
    if(e.getKeyCode()==38){
    yBar2-=10;
    if(yBar2>=225)
    yBar2=225;
    if(yBar2<=0)
    yBar2=0;
    repaint();
    for(int i=65;i<=90;i++){
    String s = "";
    switch(e.getKeyCode()){
    case 80: code=code+"p";
    break;
    case 69: code=code+"e";
    break;
    case 78: code=code+"n";
    break;
    case 73: code=code+"i";
    break;
    case 83: code=code+"s";
    break;
    case 82: code=code+"r";
    break;
    case 65: code=code+"a";
    break;
    case 75: code=code+"k";
    default:code="";
    break;
    public void keyReleased(KeyEvent e) {
    public void keyTyped(KeyEvent e) {

    Check out the tutorials on this site. Start here: http://java.sun.com/docs/books/tutorial/
    You can have a thread like this:public class Game extends java.awt.Component {
      public void init() {
        Thread t = new Thread(new GameLoop());
        t.start();
      public void paint(Graphics g) {
        // draw your game here.  Do nothing other than drawing.
      private class GameLoop { // inner class
        public void run() {
           while(true) {
              // update your game state here -- e.g., move the ball's position
              try {
                 Thread.sleep(200); // 200 miliseconds, 1/5 of a second
               catch(InterruptedException e) {
                  // this is the rare exception that it's generally OK to ignore
               repaint();
    }that's not perfect but it will get you started

  • Applet not viewable in browser

    Hi
    applet not viewable in browser any website that uses java code seems not to run on my browser though it runs normally well on my friends computer. The browser shows a screen area in grey colour with an error message like "Exception: java.lang.ClassNotFoundException:GUIDemo.class" (im using Win NT4 and IE 5.5) checked the tools/internet options/advanced seettings the browser support is enabled. tried installing the newer version of JRE still not working ..Please guide about any settings that need to be modified or how can i fix this problem ..
    Regards
    anant
    [email protected]

    Hi
    Just a thought, but what broswer are you and your friend using? Are they different by any chance?
    There is an inconsistency between browsers and java, and unfortunately it can result in the error you saw.
    Basically, bog standard Internet Explorer uses its own JVM, whereas Netscape, Mozilla, Opera etc tend to use the java plug-in. To make matters worse, if you install the plug-in on a machine that has Internet Explorer installed, it over-rules the Microsoft version to make itself the default (but this can be undone by looking in the Options menu for Java-plugin and un-ticking the box). Give that a try first.
    Another cause that I have encountered was when using NT on a network, which had been configured not to accept Java Applets at all! Are you on such a network, or stand alone?
    Hope that helps.

  • Applet not running in the broweser.

    Hello everyone I have a problem that is bugging me.
    in my pc at home i have operating system window xp i have oracle9i installed and also java and j2ee and version of internet explorer is 6.0
    .there is no proble running html pages but the problem is the applet are not running in the broweser even the java demo from sun is not running
    .when i try to run the applet a dialog box appears and shows this
    " jvm not find Download now" i do not have internet connection.
    and one more thing i want to down load or save file in webserver
    i donot know whether my pc is having default webserver but when i type this "http://localhost" a page of oracle is display listing jserver ,appache server and so many thing.
    do i have a webserver that can be used by me for java program(adv java) or i have to get one .as i told you there is java1.3 and j2ee1_2_3
    something like this i donot remember is there no default webserver along with them .how can i use them for my java programe .
    let me remind you the applet not getting downloaded in the browser is a bigger problem for me.
    i appreciate your concern please help me out
    have a nice day bye.

    1} The applet is not getting loaded in my internet
    browser.Error messages? Are you sure your setup is correct? Search. "Applet not working" usually has only a small range of reasons, all well-covered here.
    2}why the oracle page is displayed when i type
    "http://localhost".
    Maybe because you have some Oracle webserver?
    3} Do i have any default webbrowser in my system.Yes. The one that opens when you double-click on an HTML page.
    >
    thanks.

  • Java applet not working savevid keepvid

    Hi all,
    I'm sure I'm not the only one who has been confounded by Java applets not working in certain download web services; in my case, keepvid.com and savevid.com to download copies of youtube videos.  It has been a huge headache and even debilitating in my case.  I teach film and video to middle schoolers, and we often use youtube as a resource for our class projects. 
    I found a solution today, I think, and wanted to share it:
    I installed the browser called "Torch" and it seems to work fine, so far.

    thanx 4 replying
    using the browser to view Applet is not recomended that is because if u change the the source-code and recompile the applet then run it using the broswer it will run the old-version
    Also i've found the solution here
    http://www.cs.utah.edu/classes/cs1021/notes/lecture03/eclipse_help.html

  • My macbook air with snow leopard OS. migrated to OS lion and have installed Java RE. a Bank website while opening in Java shows one error which window activity shows some applets not opening. it was fine in snow leopard. will somebody help?

    My macbook air with snow leopard OS was purchased last year. Recently migrated to OS lion and have also installed Java RE. A Bank website while opening in Java shows one error which window activity shows some applets not opening. But it was fine in snow leopard. Will somebody help?

    My macbook air with snow leopard OS was purchased last year. Recently migrated to OS lion and have also installed Java RE. A Bank website while opening in Java shows one error which window activity shows some applets not opening. But it was fine in snow leopard. Will somebody help?

  • JPanel not repainting if embedded in another panel

    I have a reusable class called as DuplicatorPanel. This class has two add/ remove buttons like in Mac if you are familiar.
    The problem is that the screen gets updated with an extra row in case i have a main method in Duplicator itself. However if i have that in another panel as in HyperlinkBuilder then it does not repaint itself.
    Please can someone help ?
    package sam.dnd;
    import java.awt.event.ActionEvent;
    import java.util.Iterator;
    import java.util.LinkedHashMap;
    import java.util.Map;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import javax.swing.Box;
    import javax.swing.BoxLayout;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    public abstract class DuplicatorPanel extends Box {
        private static final long serialVersionUID = 1L;
        private static int oneup = 0;
        private Map<String, JComponent> panelMap = new LinkedHashMap<String, JComponent>();
        private Action addAction;
        private Action removeAction;
        public DuplicatorPanel() {
            super(BoxLayout.Y_AXIS);
            this.initComponents();
            this.placeComponents();
        private void initComponents() {
            addAction = new AddAction();
            removeAction = new RemoveAction();
            addDuplicatorPanel();
        private void placeComponents() {
            Iterator<JComponent> itr = this.panelMap.values().iterator();
            while(itr.hasNext()) {
                JComponent comp = (JComponent) itr.next();
                this.add(comp);
            this.add(Box.createVerticalGlue());
        private void addDuplicatorPanel() {
            int index = oneup++;
            JComponent component = this.createDuplicate();
            JButton btnAdd = new JButton("Add");
            btnAdd.setActionCommand("" + index);
            btnAdd.addActionListener(this.addAction);
            JButton btnRemove = new JButton("Remove");
            btnRemove.setActionCommand("" + index);
            btnRemove.addActionListener(this.removeAction);
            Box box = Box.createHorizontalBox();
            box.add(component);
            box.add(Box.createHorizontalGlue());
            box.add(btnAdd);
            box.add(btnRemove);
            this.panelMap.put("" + index, box);
            fireValueChanged();
        private void fireValueChanged() {
            this.removeAll();
            this.placeComponents();
            this.repaint();
        protected void doAdd() {
            addDuplicatorPanel();
            fireValueChanged();
        protected void doRemove(String key) {
            if(this.panelMap.size() == 1) {
                return;
            JComponent comp = this.panelMap.remove(key);
            if(comp != null) {
                this.fireValueChanged();
        protected abstract JComponent createDuplicate();
        class AddAction extends AbstractAction {
            private static final long serialVersionUID = 1L;
            public void actionPerformed(ActionEvent evt) {
                doAdd();
        class RemoveAction extends AbstractAction {
            private static final long serialVersionUID = 1L;
            public void actionPerformed(ActionEvent evt) {
                JButton source = (JButton) evt.getSource();
                doRemove(source.getActionCommand());
         * @param args
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.add(new MyDuplicatorPanel());
            f.setSize(200, 200);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setVisible(true);
        static class MyDuplicatorPanel extends DuplicatorPanel {
            private static final long serialVersionUID = 1L;
            public JComponent createDuplicate() {
                return new JLabel("Test");
    }This is another class that calls the above
    package sam.dnd;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;
    import java.util.HashMap;
    import javax.swing.JComboBox;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class HyperLinkBuilder extends JPanel {
        private static final long serialVersionUID = 1L;
         * @param args
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.add(new HyperLinkBuilder());
            f.setSize(200, 200);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setVisible(true);
        private static HashMap<String, String> linkNameValueMap = new HashMap<String, String>();
        private static HashMap<String, String> paramNameValueMap = new HashMap<String, String>();
        private static HashMap<String, String> valueNameValueMap = new HashMap<String, String>();
        static {
            linkNameValueMap.put("Name1", "Value1");
            linkNameValueMap.put("Name2", "Value2");
            linkNameValueMap.put("Name3", "Value3");
            paramNameValueMap.put("Name1", "Value1");
            paramNameValueMap.put("Name2", "Value2");
            paramNameValueMap.put("Name3", "Value3");
            valueNameValueMap.put("Name1", "Value1");
            valueNameValueMap.put("Name2", "Value2");
            valueNameValueMap.put("Name3", "Value3");
        private String link;
        private JComboBox linkCombo;
        private DuplicatorPanel panel;
        public HyperLinkBuilder() {
            this.initComponents();
            this.placeComponents();
            this.addListeners();
        private void initComponents() {
            linkCombo = new JComboBox(linkNameValueMap.keySet().toArray());
            panel = new MyDuplicatorPanel();
        private void placeComponents() {
            this.setLayout(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.gridx = 0;
            gbc.gridy = 0;
            this.add(linkCombo, gbc);
            gbc.gridy++;
            gbc.fill = GridBagConstraints.BOTH;
            this.add(panel, gbc);
        private void addListeners() {
            this.linkCombo.addItemListener(new LinkSelector());
        private JPanel createNameValuePanel() {
            JComboBox nameCombo = new JComboBox(paramNameValueMap.keySet().toArray());
            JComboBox valueCombo = new JComboBox(valueNameValueMap.keySet().toArray());
            JPanel panel = new JPanel();
            panel.add(nameCombo);
            panel.add(valueCombo);
            return panel;
        private void doLinkSelected() {
            String name = (String) linkCombo.getSelectedItem();
            link = linkNameValueMap.get(name);
        public String build() {
            //TODO:
            return this.link;
        class LinkSelector implements ItemListener {
            public void itemStateChanged(ItemEvent e) {
                doLinkSelected();
        class MyDuplicatorPanel extends DuplicatorPanel {
            private static final long serialVersionUID = 1L;
            @Override
            protected JComponent createDuplicate() {
                return HyperLinkBuilder.this.createNameValuePanel();
    }

    Hey Xeon,
    Replace that repaint() with revalidate. That is the trick in there.
    -Sam

  • Applet Not found in Tomcat

    Hi, I am using tomcat and put a ChatApplet.class under the directory ..../YYY/WEB-INF/classes/abc, and ChatApplet.class like this:
    package abc,
    public class ChatApplet extends Applet{
    And a JSP under the /YYY/chat directory like this:
    <applet CODE=abc.ChatApplet.class>
    </applet>
    How the JSP can't show the Applet and it said "Applet Not Found"
    PLEASE HELP

    Have you set up the context for this in your tomcat
    config files.
    Check out
    http://jakarta.apache.org/tomcat/tomcat-4.0-doc/appdev/index.html
    For set up information.
    Amlan

  • Chat applet not initialized???

    OS X on iMac...try to log in yahoo Chat but I get an error message " applet not initialized " I check every HELP suggestion but none will do nor does it properly address the issue. How does one initialize applet? Some say uninstall Java then re-install but OS X doesn't allow me to uninstall JAVA which came preinstalled. The funny thing is that the bottom portion of the yahoo chat site works but the chat area is blank.
    Can anyone help? .Mac support guys are useless they only want money! they will not offer any assistance until a payment is made. Even then they can't guarantee anything. can anyone help me? I want to CHAT ON YAHOO.
    David no say in yahoo.

    Example settings for chat, based on Safari browser:
    In Safari, select Preferences > Security > Web Content. Make sure the three check boxes pertaining to Java - "Enable Plugins", "Enable Java" and "Enable JavaScript" are active.
    Some web chat providers also require that you install their client software.
    Having never used such services, I do not know if this applies to Yahoo, or if they provide suitable client software for Mac OS X users.

  • Hi,  Trying to log in with my user id and password at iocbc but was not able to access. Problem message shown : Applet not initialised or may not be supported. Please refresh the page or check the browser setting  Anyone can advise? or i need to download?

    Hi,
    i have the same problem?
    Trying to log in with my user id and password at iocbc but was not able to access.
    Problem message shown : Applet not initialised or may not be supported. Please refresh the page or check the browser setting
    Anyone can advise?

    You need to install Java for your Mac OS version, and/or make sure it's enabled in the Java Preferences application and your browser's preferences.

  • "applet not initialized " error message  HELP !

    My applet compiles ok but when I try to run it at the bottom of the screen it says
    start : "applet not initialized"
    note - it works ok compiling from the Window console and then opening
    the .html file in the browser, but when I try the same applet in the
    BlueJ IDE ....that is when I get an error message.
    Thank you in advance
    import java.awt.*;
    import objectdraw.*;
    //A program that produces an animation of the rising and setting sun
    //The animation is driven by dragging the mouse
    public class ScrollingSun extends WindowController
    private FilledOval sun; // circle that represents the sun
    //Place the sun and some brief instructions on the screen
    public void begin()
    sun = new FilledOval(100,150,100,100,canvas);
    sun.setColor(Color.yellow);
    new Text("Drag the mouse up or down", 20,20,canvas);
    //Move the sun to follow the mouse's vertical motion
    public void onMouseDrag(Location mousePosition)
    sun.moveTo(100,mousePosition.getY() );
    <html>
    <head>
    <title> ScrollingSun
    </title>
    <body>
    <applet
    archive = "objectdraw.jar"
    codeBase = "."
    code = "ScrollingSun.class" width = 800 height = 800 >
    </applet>
    </body>
    </html>

    I put a start() around the begin() method
    and a public void init() method around the onMouseDrag() method
    but I am getting an "illegal start of expression" error message
    Thank you for your advice
    import java.awt.*;
    import objectdraw.*;
    //A program that produces an animation of the rising and setting sun
    //The animation is driven by dragging the mouse
    public class ScrollingSun extends WindowController
       private FilledOval sun;   // circle that represents the sun
      public void start()
          //Place the sun and some brief instructions on the screen
          public void begin()
             sun = new FilledOval(100,150,100,100,canvas);
             sun.setColor(Color.yellow);
             new Text("Drag the mouse up or down", 20,20,canvas);
       public void init()
           //Move the sun to follow the mouse's vertical motion
           public void onMouseDrag(Location mousePosition)
             sun.moveTo(100,mousePosition.getY() );
    }

  • Application's main window is not repainted

    Hello everybody.
    The system I am using
    Product Version: NetBeans IDE 6.5 (Build 200811100001)
    Java: 1.6.0_12; Java HotSpot(TM) Client VM 11.2-b01
    System: Windows Vista version 6.0 running on x86; Cp1251; ru_RU (nb)I created Java Desktop application (New project - Java Desktop Application (no CRUD)) and put a JTable like this:
    mainPanel[JPanel]
        jScrollPane1[JScrollPane]
            jTable1[JTable]
    I did not do anything more. But after building project I have a problem with my application - main window does not repaint itself after another window is positioned over it(calculator, for example). It repaints only after I resized main window or something like that ...
    What am I doing wrong?
    Thank you.

    I found a solution - to resolve this bug I have to set -Dsun.java2d.noddraw=true VM flag.
    I found the same bug in a database - [4139083|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4139083] and it's submit date is *15-MAY-1998* !!!
    There is also an issue about that kind of a problem - [6343853|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6343853], submit date 31-OCT-2005.
    So, I guess unfortunately there are a lot of things to think about ...

  • Applet not initialized, when I uninstall JRE1.4.1_24 on Win NT 4.0

    We have uninstalled JRE1.4.1_24 from Win NT4.0 system and installed JRE1.3.1_08. Applet not initialized error coming up when the broser tries to open applet. Please help.

    The Windows Java uninstall doesn't do a good job cleaning up after itself.
    I ended up having to reinstall JRE1.4 to getting it working again.
    Eugenio

  • I have download firefox 4 beta but now in some websites can not open. applet not load properly

    I just download fire 4 beta on my windows vista. Can not open in some websites. the message applet not load properly please reload the page

    Your More system details list doesn't show the Java plugin as installed.
    Update the [[Java]] plugin to the latest version.
    *http://kb.mozillazine.org/Java
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

Maybe you are looking for

  • How can i see which devices are connected to my wireless network?

    how can i see which devices are connected to my wireless network?

  • Trouble with Adobe Camera Raw

    I have started to use ACR (Adobe Camera Raw) for making changes to my photos before opening them up properly in Photoshop, and I have 2 quick questions: 1. The Photoshop guide I'm reading says that in the White Balance section of the 'Basic' tab (on

  • Create Pdf from a App

    Hi, I would like to create pdf file inside my App and then upload/email to internet. Is this possible? thanks, ff

  • Audigy 2 NX USB not recognized by creative installation

    Hello I am Swiss, please excuse my ugly english ;-) I have troubles with installation of the Sound Blaster Audigy 2 NX Software. It cannot find my working audigy 2 nx on USB. My System is: * Windows XP 5..2600 SP 2 Build 2600 * AMD 93 Mhz, GB RAM * N

  • N8 AND NOKIA MULTIMEDIA TRANSFER

    I was unable to connect my N8 with NMT. As per support webpage it is supportedby Nokia Multmedia Transfer for mac.http://europe.nokia.com/support/download-software/nokia-multimedia-transfer/download. This is what you need to do if you have problem to