import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Event;
import java.awt.Font;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
public class IniFrame {
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="10,10"
private JPanel jContentPane = null;
private JMenuBar jJMenuBar = null;
private JMenu fileMenu = null;
private JMenu editMenu = null;
private JMenu helpMenu = null;
private JMenuItem exitMenuItem = null;
private JMenuItem aboutMenuItem = null;
private JMenuItem cutMenuItem = null;
private JMenuItem copyMenuItem = null;
private JMenuItem pasteMenuItem = null;
private JMenuItem saveMenuItem = null;
private JMenuItem openMenuItem=null;
private JDialog aboutDialog = null;
private JPanel aboutContentPane = null;
private JLabel aboutVersionLabel = null;
private JLabel sectionLabel = null;
private JLabel valueLabel = null;
private JLabel commentLabel = null;
private JTextField sectionTextField = null;
private JTextField valueTextField = null;
private JTextField commentTextField = null;
private JButton AddButton = null;
private JButton FindButton = null;
private JLabel CommentLabel = null;
private JScrollPane ScrollPane = null;
private JTextArea CommentTextArea = null;
private JComboBox SectionComboBox =null;
private JComboBox KeyComboBox = null;
private JButton DelSectionButton = null;
private JButton DelKeyButton = null;
private JLabel SecComLabel = null;
private JLabel KeyComLabel = null;
private File file;
private String filepath;
private IniFileProcessor fileProcessor; // @jve:decl-index=0:
private JLabel keyLabel = null;
private JTextField keyTextField = null;
private final String SYMBOL_EQUAL = "=";
/**
* This method initializes sectionTextField
*
* @return javax.swing.JTextField
*/
private JTextField getSectionTextField() {
if (sectionTextField == null) {
sectionTextField = new JTextField();
sectionTextField.setLocation(new Point(7, 344));
sectionTextField.setPreferredSize(new Dimension(50, 30));
sectionTextField.setSize(new Dimension(50, 30));
}
return sectionTextField;
}
/**
* This method initializes valueTextField
*
* @return javax.swing.JTextField
*/
private JTextField getValueTextField() {
if (valueTextField == null) {
valueTextField = new JTextField();
valueTextField.setLocation(new Point(136, 344));
valueTextField.setPreferredSize(new Dimension(50, 30));
valueTextField.setSize(new Dimension(50, 30));
valueTextField.setText("");
}
return valueTextField;
}
/**
* This method initializes commentTextField
*
* @return javax.swing.JTextField
*/
private JTextField getCommentTextField() {
if (commentTextField == null) {
commentTextField = new JTextField();
commentTextField.setPreferredSize(new Dimension(50, 30));
commentTextField.setSize(new Dimension(50, 30));
commentTextField.setLocation(new Point(205, 344));
}
return commentTextField;
}
/**
* This method initializes AddButton
*
* @return javax.swing.JButton
*/
private JButton getAddButton() {
if (AddButton == null) {
AddButton = new JButton();
AddButton.setVerticalTextPosition(SwingConstants.BOTTOM);
AddButton.setSize(new Dimension(69, 30));
AddButton.setPreferredSize(new Dimension(60, 30));
AddButton.setText("Add");
AddButton.setLocation(new Point(270, 298));
}
AddButton.addActionListener(new AddButtonListener());
return AddButton;
}
/**
* This method initializes FindButton
*
* @return javax.swing.JButton
*/
private JButton getFindButton() {
if (FindButton == null) {
FindButton = new JButton();
FindButton.setLocation(new Point(270, 344));
FindButton.setPreferredSize(new Dimension(60, 30));
FindButton.setText("Find");
FindButton.setSize(new Dimension(68, 30));
FindButton.addActionListener(new findButtonListener());
}
return FindButton;
}
/**
* This method initializes ScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getScrollPane() {
if (ScrollPane == null) {
ScrollPane = new JScrollPane();
ScrollPane.setLocation(new Point(38, 62));
ScrollPane.setSize(new Dimension(125, 135));
ScrollPane.setViewportView(getCommentTextArea());
ScrollPane.setPreferredSize(new Dimension(120, 130));
}
return ScrollPane;
}
/**
* This method initializes CommentTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getCommentTextArea() {
if (CommentTextArea == null) {
CommentTextArea = new JTextArea();
CommentTextArea.setSize(new Dimension(120, 130));
CommentTextArea.setRows(20);
CommentTextArea.setPreferredSize(new Dimension(50, 130));
}
return CommentTextArea;
}
/**
* This method initializes SectionComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getSectionComboBox() {
if(SectionComboBox==null)
{
SectionComboBox = new JComboBox();
SectionComboBox.setLocation(new Point(192, 65));
SectionComboBox.setPreferredSize(new Dimension(120, 30));
SectionComboBox.setEditable(true);
SectionComboBox.setSelectedIndex(-1);
SectionComboBox.setSize(new Dimension(120, 30));
SectionComboBox.addActionListener(new ShowkeyvaluListener());
}
return SectionComboBox;
}
/**
* This method initializes KeyComboBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getKeyComboBox() {
if (KeyComboBox == null) {
KeyComboBox = new JComboBox();
KeyComboBox.setLocation(new Point(192, 137));
KeyComboBox.setPreferredSize(new Dimension(120, 30));
KeyComboBox.setEditable(true);
KeyComboBox.setSelectedIndex(-1);
KeyComboBox.setSize(new Dimension(120, 30));
KeyComboBox.addActionListener(new showCommentListener());
}
return KeyComboBox;
}
/**
* This method initializes DelSectionButton
*
* @return javax.swing.JButton
*/
private JButton getDelSectionButton() {
if (DelSectionButton == null) {
DelSectionButton = new JButton();
DelSectionButton.setLocation(new Point(357, 298));
DelSectionButton.setPreferredSize(new Dimension(80, 30));
DelSectionButton.setText("DelSec");
DelSectionButton.setFont(new Font("Dialog", Font.BOLD, 12));
DelSectionButton.setSize(new Dimension(80, 30));
DelSectionButton.addActionListener(new delSectionListener());
}
return DelSectionButton;
}
/**
* This method initializes DelKeyButton
*
* @return javax.swing.JButton
*/
private JButton getDelKeyButton() {
if (DelKeyButton == null) {
DelKeyButton = new JButton();
DelKeyButton.setLocation(new Point(357, 344));
DelKeyButton.setPreferredSize(new Dimension(80, 30));
DelKeyButton.setText("DelKey");
DelKeyButton.setSize(new Dimension(80, 30));
DelKeyButton.addActionListener(new delkeyListener());
}
return DelKeyButton;
}
/**
* This method initializes keyTextField
*
* @return javax.swing.JTextField
*/
private JTextField getKeyTextField() {
if (keyTextField == null) {
keyTextField = new JTextField();
keyTextField.setLocation(n