Thu Jan 31, 2013 10:58 pm
class myToolbar extends JToolBar {
public myToolbar(final JTabbedPane Tabbed, final JFrame myMother, final Connection conn) {
// setLayout(null);
AddImag = new ImageIcon("icons/Add.png");
SearchImag = new ImageIcon("icons/Search.png");
ModifyImag = new ImageIcon("icons/Modify.png");
RemoveImag = new ImageIcon("icons/Remove.png");
BorrowImag = new ImageIcon("icons/Borrow.png");
ReturnImag = new ImageIcon("icons/Return.png");
ReportImag = new ImageIcon("icons/Report.png");
AddBut = new JButton("Add", AddImag);
SearchBut = new JButton("Search", SearchImag);
ModifyBut = new JButton("Modify", ModifyImag);
RemoveBut = new JButton("Remove", RemoveImag);
BorrowBut = new JButton("Borrow", BorrowImag);
ReturnBut = new JButton("Return", ReturnImag);
ReportBut = new JButton("Report", ReportImag);
AddBut.setAlignmentY(CENTER_ALIGNMENT);
SearchBut.setAlignmentY(CENTER_ALIGNMENT);
ModifyBut.setAlignmentY(CENTER_ALIGNMENT);
RemoveBut.setAlignmentY(CENTER_ALIGNMENT);
ReturnBut.setAlignmentY(CENTER_ALIGNMENT);
ReportBut.setAlignmentY(CENTER_ALIGNMENT);
add(AddBut);
add(SearchBut);
add(ModifyBut);
add(RemoveBut);
add(BorrowBut);
add(ReturnBut);
add(ReportBut);
AddBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
switch (Tabbed.getSelectedIndex()) {
case 0:
((new VisitorPanel(conn, myMother))).show();
break;
case 1:
(new BookPanel(conn, myMother)).show();
break;
case 2:
(new AuthorPanel(conn, myMother)).show();
break;
case 3:
(new PublisherPanel(conn, myMother)).show();
break;
case 4:
(new BookStorePanel(conn, myMother)).show();
break;
default:
break;
}
}
});
SearchBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
switch (Tabbed.getSelectedIndex()) {
case 0:
(new VisitorSearch(conn, myMother)).show();
break;
case 1:
(new BookSearch(conn, myMother)).show();
break;
case 2:
(new AuthorSearch(conn, myMother)).show();
break;
case 3:
(new PublisherSearch(conn, myMother)).show();
break;
case 4:
(new BookStoreSearch(conn, myMother)).show();
break;
default:
break;
}
}
});
ModifyBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
switch (Tabbed.getSelectedIndex()) {
case 0:
(new VisitorModifyPanel(conn, myMother)).show();
break;
case 1:
(new BookModifyPanel(conn, myMother)).show();
break;
case 2:
(new AuthorModifyPanel(conn, myMother)).show();
break;
case 3:
(new PublisherModifyPanel(conn, myMother)).show();
break;
case 4:
(new BookStoreModifyPanel(conn, myMother)).show();
break;
default:
break;
}
}
});
RemoveBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
switch (Tabbed.getSelectedIndex()) {
case 0:
(new VisitorRemovePanel(conn, myMother)).show();
break;
case 1:
(new BookRemovePanel(conn, myMother)).show();
break;
case 2:
(new AuthorRemovePanel(conn, myMother)).show();
break;
case 3:
(new PublisherRemovePanel(conn, myMother)).show();
break;
case 4:
(new BookStoreRemovePanel(conn, myMother)).show();
break;
default:
break;
}
}
});
ReturnBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
ReportBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
}
private JButton AddBut;
private JButton SearchBut;
private JButton ModifyBut;
private JButton RemoveBut;
private JButton BorrowBut;
private JButton ReturnBut;
private JButton ReportBut;
private Icon AddImag;
private Icon SearchImag;
private Icon ModifyImag;
private Icon RemoveImag;
private Icon BorrowImag;
private Icon ReturnImag;
private Icon ReportImag;
}
|
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.