Scrollbalken wird nicht angezeigt

J

JustDoIT

hallo
ein wenig weiter unten steht mein Java-Programm im Anfangsstadion.
ich möchte gerne wissen warum der Scrollbalken nicht angezeigt wird bzw was ich machen muss, damit der Scrollbalken angezeigt wird




import java.awt.*;
import java.util.*;
import java.awt.event.*;
import java.awt.event.KeyListener.*;
import java.awt.Scrollbar.*;
import java.applet.Applet.*;



public class bildanzeige extends Frame implements ActionListener, KeyListener, AdjustmentListener{


Toolkit toolkit = Toolkit.getDefaultToolkit();
Image pic;
int x, y;
Label labClock= new Label();
private Scrollbar scrollbarX,scrollbarY,scrollbarZ,scrollbarLevel;

mycanvas canv = new mycanvas();
Color farbe = new Color(148, 187, 216);
Graphics g = getGraphics();




public static void main(String[] args) {


bildanzeige frame = new bildanzeige();
frame.setVisible(true);
frame.setResizable(false);
frame.setLocation(200, 200);

Color farbe = new Color(148, 187, 216);
frame.setBackground(farbe);

}



public bildanzeige() {

super("FAXANZEIGE");

Panel panel = new Panel();

panel.setLayout(new BorderLayout());

Scrollbar hsb = new Scrollbar(Scrollbar.HORIZONTAL,1,10,1,100); //Scrollbalken wird nicht angezeigt
hsb.addAdjustmentListener(this);
panel.add("South",hsb);

setSize(800, 600);


addWindowListener(new winAdapter(true));
addKeyListener(this);

canv.setSize(800, 600);
canv.setBackground(farbe);
add(canv);


toolkit = Toolkit.getDefaultToolkit();
pic = toolkit.getImage("D:\\Eigene Dateien Georg\\Prog\\smile.jpg");
show();

}





public void actionPerformed(ActionEvent e) {

String what = e.getActionCommand();

if (what == "Exit") {
this.setVisible(false);
this.dispose();
System.exit(0);
}

}





class mycanvas extends Canvas {
public void paint(Graphics g) {

if (pic != null) {
int bildBreite = pic.getWidth(this);
int bildHoehe = pic.getHeight(this);
g.drawImage(pic, x, y, bildBreite, bildHoehe, this);
}

}
}




public void keyPressed(KeyEvent ev)
{
if (ev.getKeyCode() == KeyEvent.VK_S) { y=y+3; }
if (ev.getKeyCode() == KeyEvent.VK_W) { y=y-3; }
if (ev.getKeyCode() == KeyEvent.VK_D) { x=x+3; }
if (ev.getKeyCode() == KeyEvent.VK_A) { x=x-3; }
}


public void keyReleased(KeyEvent e) {}
public void keyTyped(KeyEvent e) {}


public void adjustmentValueChanged(AdjustmentEvent event) {

Adjustable sb = event.getAdjustable();
if (sb.getOrientation() == Scrollbar.HORIZONTAL) {
System.out.print("Horizontal: ");
} else {
System.out.print("Vertikal: ");
}
switch (event.getAdjustmentType()) {
case AdjustmentEvent.UNIT_INCREMENT:
System.out.println("AdjustmentEvent.UNIT_INCREMENT");
break;
case AdjustmentEvent.UNIT_DECREMENT:
System.out.println("AdjustmentEvent.UNIT_DECREMENT");
break;
case AdjustmentEvent.BLOCK_DECREMENT:
System.out.println("AdjustmentEvent.BLOCK_DECREMENT");
break;
case AdjustmentEvent.BLOCK_INCREMENT:
System.out.println("AdjustmentEvent.BLOCK_INCREMENT");
break;
case AdjustmentEvent.TRACK:
System.out.println("AdjustmentEvent.TRACK");
break;
}
System.out.println(" value: " + event.getValue());


}

}