मेरे पास यह कोड है जिसमें मैं स्क्रोल करने योग्य पैनल (जेपीनल) फिट करने की कोशिश कर रहा हूं लेकिन मुझे यह नहीं मिला। यहां मेरा कोड है:जावा में जेएफआरएएम स्क्रॉल करने योग्य कैसे करें?
public class Sniffer_GUI extends JFrame {
Canvas c = new Canvas();
ConnectorPropertiesPanel props;
public Sniffer_GUI() {
super("JConnector demo");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new GridBagLayout());
init();
getContentPane().add(new JLabel("Connectors example. You can drag the connected component to see how the line will be changed"),
new GridBagConstraints(0, 0, 2, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0));
getContentPane().add(initConnectors(),
new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
getContentPane().add(props,
new GridBagConstraints(1, 1, 1, 1, 0, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.VERTICAL, new Insets(5, 0, 5, 5), 0, 0));
setSize(800, 600);
setLocationRelativeTo(null);
}
अग्रिम धन्यवाद।
मैं कम से कम यह एक jScrollPane अंदर अपने कार्य करता है, एक अच्छा कदम है एक कोड आंशिक रूप से काम करने के लिए लगता है कि जोड़ने के लिए संपादित करें ...
public Sniffer_GUI() {
super("JConnector demo");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel container = new JPanel();
JScrollPane scrPane = new JScrollPane(container);
add(scrPane);
scrPane.setLayout(new ScrollPaneLayout());
init();
add(initConnectors());
setSize(800, 600);
setLocationRelativeTo(null);
}
लेकिन यह अभी भी स्क्रॉल नहीं है,।
जहाँ आपके कोड जो jScrollPane का उपयोग करने की कोशिश करता है? – Puce
@Puce शायद वह JScrollPane के बारे में नहीं जानता था। – brimborium
मुझे JScrollPane चर घोषित करने से आगे नहीं पता ... = ( –