私は2つの内部フレームを持つフレームを持っています。私はBoardクラスのインスタンスである 'Board'オブジェクトを作成します。ボードクラスはJPanelを拡張します。JScrollPaneが動作しません。なぜですか?
class Layout extends JFrame{
Dimension dimen=Toolkit.getDefaultToolkit().getScreenSize();
public initializeWindows(){
JInternalFrame dev=new JInternalFrame("Devices",true,true,false,false);
JInternalFrame cir=new JInternalFrame("Circuit",true,true,false,false);
Board b=new Board();
cir.add(b);
JScrollPane scroll=new JScrollPane(b);
this.add(dev);
this.add(cir);
dev.setVisible(true);
dev.setSize(150,650);
dev.setLocation(0,100);
dev.pack();
inf.setVisible(true);
inf.setPreferredSize(new Dimension((int)(dimen.width*0.88),(int)(dimen.height*0.75)));
inf.setLocation(150,100);
inf.setBackground(Color.WHITE);
inf.pack();
}
ただし、スクロールペインは表示されません。なぜtatですか?
「ScrollPane」を追加してください。例:http://www.java2s.com/Tutorial/Java/0240__Swing/AddcomponenttoJScrollPane.htm – Anonymous
this.add(スクロール)を呼び出すことによって、JFrameにスクロールオブジェクトを追加する必要があります。 – dexametason
**コンパイルできなかったコードを追加したのはなぜですか**より早い時期に役立つようにするには、[SSCCE](http://sscce.org/)を投稿してください。しかし、その後私はちょうど***あなたに言及されていることを実現しました。(http://stackoverflow.com/questions/9767652/accessing-a-line-after-it-is-painted)*** –