?? preferencepanel.java
字號(hào):
package de.uni_bremen.informatik.p2p.plugins.filesharing.gui;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import de.uni_bremen.informatik.p2p.peeranha42.core.plugin.gui.P42_application_pane;
import de.uni_bremen.informatik.p2p.plugins.filesharing.control.UserInputManager;
import de.uni_bremen.informatik.p2p.plugins.filesharing.data.FilesharingState;
/**
* @author Lars Kordes
*/
//public class PreferencePanel extends P42_preferences_pane implements ActionListener {
public class PreferencePanel extends P42_application_pane implements ActionListener {
private JLabel lab;
private final static String PANEL_NAME = "Preferences";
public PreferencePanel() {
super(PANEL_NAME, P42_application_pane.ATTACHED, FilesharingState.pluginid);
setLayout(new FlowLayout());
lab = new JLabel("Download directory: " + FilesharingState.config.getValue("download_directory"));
add(lab);
JButton directorybutton = new JButton("Choose");
// tooltip
directorybutton.setToolTipText("Press Button to choose download directory");
// set size
directorybutton.setPreferredSize(new Dimension(100, 20));
// add actionlistener
directorybutton.addActionListener(this);
add(directorybutton);
}
public String getName() {
return PANEL_NAME;
}
public void actionPerformed(ActionEvent arg0) {
if (arg0.getActionCommand().equals("Choose")) UserInputManager.chooseDownloadDirectory();
Runnable update = new Runnable() {
public void run() {
lab.setText("Download directory: " + FilesharingState.config.getValue("download_directory"));
}
};
SwingUtilities.invokeLater(update);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -