?? playlist.java
字號:
if (e.isPopupTrigger()) {
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
});
// ====================popup1========================
String list1[] = { "Add List", "Delete List" };
MenuItem add1 = new MenuItem(list1[0]);
MenuItem delete1 = new MenuItem(list1[1]);
popup1.add(add1);
popup1.add(delete1);
add1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AddListActionPerformed();
}
});
delete1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DeleteListActionPerformed();
}
});
Playlist1.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
check(e);
}
public void mouseReleased(MouseEvent e) {
check(e);
}
private void check(MouseEvent e) {
if (e.isPopupTrigger()) {
popup1.show(e.getComponent(), e.getX(), e.getY());
}
}
});
// ======== this ========
Container contentPane = getContentPane();
panel.setSize(new Dimension(290, 269));
panel.setBorder(BorderFactory.createMatteBorder(2, 3, 2, 3, new Color(
219, 222, 143)));//
panel.setLayout(new FormLayout(ColumnSpec.decodeSpecs("261dlu"),
new RowSpec[] { new RowSpec(Sizes.dluY(142)),
FormFactory.LINE_GAP_ROWSPEC,
new RowSpec(Sizes.dluY(18)) }));
// ==================panel2==========
{
panel2.setLayout(new FormLayout(new ColumnSpec[] {
new ColumnSpec(Sizes.dluX(45)),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec(Sizes.dluX(140)) }, RowSpec
.decodeSpecs("146dlu")));
// ======== scrollPane2 ========
{
// ---- Playlist1 ----
Playlist1.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
ListValueChanged();
}
});
Playlist1.add(popup1);
Playlist1.setFont(new Font("Book Antiqua", Font.BOLD, 12));
scrollPane2.setViewportView(Playlist1);
Playlist1.setBackground(new Color(199, 237, 184));
}
panel2.add(scrollPane2, cc.xywh(1, 1, 1, 1, CellConstraints.FILL,
CellConstraints.FILL));
// ======== scrollPane1 ========
{
// ---- Playlist ----
Playlist.add(popup);
Playlist.setFont(new Font("Book Antiqua", Font.BOLD, 12));
scrollPane1.add(Playlist);
Playlist.setBackground(new Color(199, 237, 184));
}
panel2.add(scrollPane1, cc.xywh(3, 1, 1, 1, CellConstraints.FILL,
CellConstraints.FILL));
}
panel.add(panel2, cc.xy(1, 1));
// ======== panel1 ========
{
panel1.setLayout(new FormLayout(new ColumnSpec[] {
new ColumnSpec(Sizes.dluX(45)),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec(Sizes.dluX(30)),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec(Sizes.dluX(30)),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec(Sizes.dluX(30)),
FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
new ColumnSpec(Sizes.dluX(30)) }, RowSpec
.decodeSpecs("default")));
// ---- AddList ----
AddList.setText("AdList");
AddList.setFont(new Font("Book Antiqua", Font.PLAIN, 12));
AddList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AddListActionPerformed();
}
});
panel1.add(AddList, cc.xy(3, 1));
// ---- Delete ----
DeleteList.setText("DelList");
DeleteList.setFont(new Font("Book Antiqua", Font.PLAIN, 12));
DeleteList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DeleteListActionPerformed();
}
});
panel1.add(DeleteList, cc.xy(5, 1));
// ---- Add ----
Add.setText("Add");
Add.setFont(new Font("Book Antiqua", Font.PLAIN, 12));
Add.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
AddActionPerformed();
}
});
panel1.add(Add, cc.xy(7, 1));
// ---- Delete ----
Delete.setText("Delete");
Delete.setFont(new Font("Book Antiqua", Font.PLAIN, 12));
Delete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DeleteActionPerformed();
}
});
panel1.add(Delete, cc.xy(9, 1));
// ---- Skin ----
Green.setSelected(true);
Skin.add(Green);
Skin.add(Challenger);
Skin.add(RavenGra);
Skin.add(Raven);
Skin.add(Autumn);
skinGroup = new ButtonGroup();
skinGroup.add(Green);
skinGroup.add(Challenger);
skinGroup.add(RavenGra);
skinGroup.add(Raven);
skinGroup.add(Autumn);
Green.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
UIManager
.setLookAndFeel("org.jvnet.substance.skin.SubstanceGreenMagicLookAndFeel");
Playlist.setBackground(new Color(199, 237, 184));
Playlist1.setBackground(new Color(199, 237, 184));
Playlist.setForeground(Color.DARK_GRAY);
Playlist1.setForeground(Color.DARK_GRAY);
} catch (Exception e) {
e.printStackTrace();
}
}
});
Challenger.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
UIManager
.setLookAndFeel("org.jvnet.substance.skin.SubstanceChallengerDeepLookAndFeel");
Playlist.setBackground(new Color(50, 38, 93));
Playlist.setForeground(Color.LIGHT_GRAY);
Playlist1.setBackground(new Color(50, 38, 93));
Playlist1.setForeground(Color.LIGHT_GRAY);
} catch (Exception e) {
e.printStackTrace();
}
}
});
RavenGra.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
UIManager
.setLookAndFeel("org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel");
Playlist.setBackground(new Color(88, 88, 93));
Playlist.setForeground(Color.white);
Playlist1.setBackground(new Color(88, 88, 93));
Playlist1.setForeground(Color.white);
} catch (Exception e) {
e.printStackTrace();
}
}
});
Raven.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
UIManager
.setLookAndFeel("org.jvnet.substance.skin.SubstanceRavenLookAndFeel");
Playlist.setBackground(new Color(57, 43, 43));
Playlist.setForeground(Color.white);
Playlist1.setBackground(new Color(57, 43, 43));
Playlist1.setForeground(Color.white);
} catch (Exception e) {
e.printStackTrace();
}
}
});
Autumn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
UIManager
.setLookAndFeel("org.jvnet.substance.skin.SubstanceAutumnLookAndFeel");
Playlist.setBackground(new Color(250, 234, 193));
Playlist.setForeground(Color.DARK_GRAY);
Playlist1.setBackground(new Color(250, 234, 193));
Playlist1.setForeground(Color.DARK_GRAY);
} catch (Exception e) {
e.printStackTrace();
}
}
});
bar.add(Skin);
panel1.add(bar, cc.xy(1, 1));
}
panel.add(panel1, cc.xy(1, 3));
contentPane.add(panel);
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization
// //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY
// //GEN-BEGIN:variables
// Generated using JFormDesigner non-commercial license
private ScrollPane scrollPane1;
protected List Playlist;
private JScrollPane scrollPane2;
protected JList Playlist1;
private JPanel panel2;
private JPanel panel1;
private JButton Add,AddList;
private JButton Delete,DeleteList;
private JPanel panel;
private JMenu Skin;
private JRadioButtonMenuItem Green;
private JRadioButtonMenuItem Challenger;
private JRadioButtonMenuItem RavenGra;
private JRadioButtonMenuItem Raven;
private JRadioButtonMenuItem Autumn;
private ButtonGroup skinGroup;
private JMenuBar bar;
private PopupMenu popup, popup1;
protected HashMap hashmap; // 存儲音樂列表
protected DefaultListModel model;
private ObjectInputStream input;
private ObjectOutputStream output;
private Record record;
private File file;
// JFormDesigner - End of variables declaration //GEN-END:variables
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -