Hallo wollte mal gerne fragen, ob man in einem SpringLayout einen Border Setzten kann mit dem Boxlayout. Also ich habe ein Form geschrieben wo man Titel und Preis der Dvd eingeben kann.Darüber herum will ein Border haben, aber weis nicht wie ich das einsetzten soll.
Hier mein Code
würde mich sehr freuen wenn ihr weiter helfen könntet
Hier mein Code
Code:
import java.awt.Component;
import java.awt.Container;
import javax.swing.*;
public class NewClass {
public static void main(String args[]) {
JFrame frame = new JFrame("SpringLayout");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = frame.getContentPane();
SpringLayout layout = new SpringLayout();
contentPane.setLayout(layout);
Component left = new JLabel("Title: ");
Component right = new JTextField(15);
Component Price = new JLabel("Price:");
Component price1 = new JTextField(15);
contentPane.add(left);
contentPane.add(right);
contentPane.add(Price);
contentPane.add(price1);
layout.putConstraint(SpringLayout.WEST, left, 10, SpringLayout.WEST, contentPane);
layout.putConstraint(SpringLayout.NORTH, left, 25, SpringLayout.NORTH, contentPane);
layout.putConstraint(SpringLayout.NORTH, right, 25, SpringLayout.NORTH, contentPane);
layout.putConstraint(SpringLayout.WEST, right, 10, SpringLayout.EAST, left);
layout.putConstraint(SpringLayout.WEST, Price, 10, SpringLayout.WEST, contentPane);
layout.putConstraint(SpringLayout.NORTH, Price, 55, SpringLayout.NORTH, contentPane);
layout.putConstraint(SpringLayout.NORTH, price1, 55, SpringLayout.NORTH, contentPane);
layout.putConstraint(SpringLayout.WEST, price1, 10, SpringLayout.EAST, left);
frame.setSize(600, 300);
frame.setVisible(true);
}
}
würde mich sehr freuen wenn ihr weiter helfen könntet