So, I try to add components to JScrollPane, but they appear only when I hover my mouse above them.
This is my code:
package com.alex.apps;
import java.awt.CardLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ScrollPaneLayout;
public class main {
public static void main(String[] args) {
// TODO Auto-generated method stub
//GetPageInfo gpi=new GetPageInfo();
JFrame frame=new JFrame("Bookmark");
JScrollPane pane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
frame.setContentPane(pane);
JTextField text=new JTextField();
text.setBounds(0, 10, 400, 40);
pane.add(text);
JButton add=new JButton("+");
add.setBounds(403, 10, 40, 40);
pane.add(add);
frame.setSize(480, 860);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
Do you have any idea why it doesn't work?
