From ed3e023d1da3465bc79a91d38950a167004911b2 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sat, 16 Nov 2024 02:11:24 +0530 Subject: First Commit --- src/UI/Components/InputBox.java | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/UI/Components/InputBox.java (limited to 'src/UI/Components/InputBox.java') diff --git a/src/UI/Components/InputBox.java b/src/UI/Components/InputBox.java new file mode 100644 index 0000000..c15381e --- /dev/null +++ b/src/UI/Components/InputBox.java @@ -0,0 +1,39 @@ +package UI.Components; + +import javax.swing.*; +import java.awt.*; + +public class InputBox extends JPanel { + JLabel label; + JTextField textField; + + public InputBox(String label) { + this.label = new JLabel(label); + this.label.setPreferredSize(new Dimension(70, 30)); + this.add(this.label); + + this.add(Box.createHorizontalGlue()); + + this.textField = new JTextField(20); + this.add(this.textField); + + this.setLayout(new FlowLayout(FlowLayout.CENTER)); + } + + public String getLabel() { + return this.label.getText(); + } + + public String getValue() { + return this.textField.getText(); + } + + public void setLabel(String label) { + this.label.setText(label); + } + + public void setValue(String value) { + this.textField.setText(value); + this.textField.repaint(); + } +} -- cgit v1.2.3