Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: thomasabraham/Agricultural-Product-Management-System
base: 62e2bc56ca
...
head fork: thomasabraham/Agricultural-Product-Management-System
compare: 644abb10ce
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 101 additions and 11 deletions.
  1. +101 −11 src/installdb.java
View
112 src/installdb.java
@@ -3,15 +3,23 @@
import java.awt.event.WindowEvent;
import java.awt.event.ActionListener;
import java.awt.GridLayout;
+import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JButton;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+import javax.swing.JCheckBox;
class InstallDB implements ActionListener{
JFrame win;
JLabel step,message;
- JPanel controlPanel,northPanel,centerPanel;
+ JPanel controlPanel,northPanel,centerPanel,chooseDbms,urlPanel,authPanel,APC;
JButton next,previous,cancel,finish;
int ns,cs;
+ JRadioButton mysql,oracle;
+ ButtonGroup dbms;
+ JTextField url,uname,pwd;
+ JCheckBox savepwd;
public InstallDB(){
win = new JFrame();
win.setTitle("AgriPro Database Installation.");
@@ -53,24 +61,106 @@ public void windowClosing(WindowEvent we){
win.add(centerPanel,"Center");
ns = 5;
cs = 1;
+ mysql = new JRadioButton("MySQL. (Recommented)");
+ mysql.setSelected(true);
+ oracle = new JRadioButton("Oracle.");
+ dbms = new ButtonGroup();
+ dbms.add(mysql);
+ dbms.add(oracle);
+ chooseDbms = new JPanel();
+ chooseDbms.add(mysql);
+ chooseDbms.add(oracle);
+ url = new JTextField(40);
+ url.setText("localhost");
+ urlPanel = new JPanel();
+ urlPanel.add(new JLabel("URL : "));
+ urlPanel.add(url);
+ authPanel = new JPanel();
+ authPanel.setLayout(new GridLayout(0,4));
+ uname = new JTextField(20);
+ pwd = new JTextField(20);
+ authPanel.add(new JLabel(" "));
+ authPanel.add(new JLabel("UserName : ",JLabel.RIGHT));
+ authPanel.add(uname);
+ authPanel.add(new JLabel(" "));
+ authPanel.add(new JLabel(" "));
+ authPanel.add(new JLabel(" PassWord : ",JLabel.RIGHT));
+ authPanel.add(pwd);
+ authPanel.add(new JLabel(" "));
+ authPanel.add(new JLabel(" "));
+ authPanel.add(new JLabel(" "));
+ savepwd = new JCheckBox("Save Password?");
+ authPanel.add(savepwd);
+ APC = new JPanel();
+ APC.add(authPanel);
+
}
public static void main(String s[]){
InstallDB idb = new InstallDB();
- idb.startWizard();
- }
- public void startWizard(){
- previous.setEnabled(false);
- finish.setEnabled(false);
- step.setText("Step "+cs+"/"+ns);
- message.setText("Welcome to AgriPro database Installation wizard. ");
- win.setVisible(true);
+ idb.startStep1();
}
public void actionPerformed(java.awt.event.ActionEvent ae){
if(ae.getSource()==cancel){
//TO DO; add confirmation dialogue.
System.exit(0);
+ }else if(ae.getSource()==finish){
+ System.exit(0);
+ }else if(ae.getSource()==next){
+ finish();
+ start();
+ }else if(ae.getSource()==previous){
+ cs--;
+ start();
}
- //To Do; add Actions for all other buttons.
+ }
+ public void finish(){
+ if(cs == 1||cs == 2||cs == 3){
+ cs++;
+ }
+ }
+ public void start(){
+ if(cs == 1)
+ startStep1();
+ else if(cs == 2)
+ startStep2();
+ else if(cs == 3)
+ startStep3();
+ else if(cs == 4)
+ startStep4();
+ }
+ public void startStep1(){
+ previous.setEnabled(false);
+ finish.setEnabled(false);
+ step.setText("Step "+cs+"/"+ns);
+ message.setText("<html><b>Welcome to database installation wizard.<b><br/><br/>This wizard will guide you through the installation process of the database of Agricultural Product Mannagement System. </html>");
+ centerPanel.remove(chooseDbms);
+ win.setVisible(true);
+ }
+ public void startStep2(){
+ previous.setEnabled(true);
+ step.setText("Step "+cs+"/"+ns);
+ message.setText("Choose your DBMS from the following.");
+ centerPanel.setVisible(false);
+ centerPanel.add(chooseDbms);
+ centerPanel.remove(urlPanel);
+ centerPanel.setVisible(true);
+ }
+ public void startStep3(){
+ step.setText("Step "+cs+"/"+ns);
+ message.setText("<html>Enter URL to your DBMS.<br/><br/>Enter 'localhost' if your DBMS is in the same machine. </html>");
+ centerPanel.setVisible(false);
+ centerPanel.remove(chooseDbms);
+ centerPanel.remove(APC);
+ centerPanel.add(urlPanel);
+ centerPanel.setVisible(true);
+ }
+ public void startStep4(){
+ step.setText("Step "+cs+"/"+ns);
+ message.setText("<html>Enter your username and password.<br/><br/>Contact DBMS Administrator if you don't have. </html>");
+ centerPanel.setVisible(false);
+ centerPanel.remove(urlPanel);
+ centerPanel.add(APC);
+ centerPanel.setVisible(true);
}
//To Do ; add functions for each step.
-};
+}

No commit comments for this range

Something went wrong with that request. Please try again.