defenderH2O
Grünschnabel
hi
nach hin und her probieren habe ich versucht die toolbar buttons zum laufen zu birngen im
bestehenden source!
nun habe ich die tabs deaktiviert um nur mit den toolbar buttons zu nutzen für die dialoge mit JPanel und Cardlayout!
nach erfolgreichem kompilieren kann ich das gui nicht mehr sehen ob es überhaupt geklappt hat. ich sehe es im hintergrund im taskmanger das es läuft.
ich weis nicht ob irgendwo was vergessen habe?
und wenn ich das einfüge
bekomme ich fehler:
hier der abschnitt vom mainframe.java source:
nach hin und her probieren habe ich versucht die toolbar buttons zum laufen zu birngen im
bestehenden source!
nun habe ich die tabs deaktiviert um nur mit den toolbar buttons zu nutzen für die dialoge mit JPanel und Cardlayout!
nach erfolgreichem kompilieren kann ich das gui nicht mehr sehen ob es überhaupt geklappt hat. ich sehe es im hintergrund im taskmanger das es läuft.
ich weis nicht ob irgendwo was vergessen habe?
und wenn ich das einfüge
Code:
public static void main(String args[]) {new Mainframe().setVisible(true);}
Code:
...\MainFrame.java:106: cannot find symbol
symbol : constructor MainFrame()
location: class de.todesbaum.freemule.gui.MainFrame
public static void main(String args[]) {new MainFrame().setVisib
(true);}
^
1 error
hier der abschnitt vom mainframe.java source:
Code:
package de.todesbaum.freemule.gui;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.ByteArrayOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.StringTokenizer;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;
import de.todesbaum.freemule.application.AnnouncementListener;
import de.todesbaum.freemule.application.AnnouncementService;
import de.todesbaum.freemule.application.Client;
import de.todesbaum.freemule.application.ClientListener;
import de.todesbaum.freemule.application.ClientService;
import de.todesbaum.freemule.application.ClipboardListener;
import de.todesbaum.freemule.application.ClipboardService;
import de.todesbaum.freemule.application.DiscoveryListener;
import de.todesbaum.freemule.application.DiscoveryService;
import de.todesbaum.freemule.application.DownloadListener;
import de.todesbaum.freemule.application.DownloadService;
import de.todesbaum.freemule.application.FilelistCollectorListener;
import de.todesbaum.freemule.application.FilelistCollectorService;
import de.todesbaum.freemule.application.FilelistInsertListener;
import de.todesbaum.freemule.application.FilelistInsertService;
import de.todesbaum.freemule.application.FilelistListener;
import de.todesbaum.freemule.application.FilelistService;
import de.todesbaum.freemule.application.FreeMule;
import de.todesbaum.freemule.application.FreenetFile;
import de.todesbaum.freemule.application.Service;
import de.todesbaum.freemule.application.ServiceListener;
import de.todesbaum.freemule.application.ServiceThread;
import de.todesbaum.freemule.application.SharedFile;
import de.todesbaum.freemule.application.SharedFileListener;
import de.todesbaum.freemule.application.SharedFileService;
import de.todesbaum.freemule.application.UploadFile;
import de.todesbaum.freemule.application.UploadListener;
import de.todesbaum.freemule.application.UploadRequest;
import de.todesbaum.freemule.application.UploadRequestDiscoveryListener;
import de.todesbaum.freemule.application.UploadRequestDiscoveryService;
import de.todesbaum.freemule.application.UploadRequestInsertListener;
import de.todesbaum.freemule.application.UploadRequestInsertService;
import de.todesbaum.freemule.application.UploadRequestListener;
import de.todesbaum.freemule.application.UploadRequestService;
import de.todesbaum.freemule.application.UploadService;
import de.todesbaum.freemule.main.Configuration;
import de.todesbaum.freemule.main.LoggingPreferences;
import de.todesbaum.freemule.main.Version;
/**
* @author <a href="mailto:droden@gmail.com">David Roden</a>
* @version $Id:MainFrame.java 221 2006-03-06 14:46:49Z bombe $
*/
public class MainFrame extends JFrame implements ServiceListener, SharedFileListener, FilelistInsertListener, FilelistCollectorListener, DownloadListener, UploadRequestInsertListener, UploadRequestDiscoveryListener, DiscoveryListener, AnnouncementListener, ClientListener, ClipboardListener, FilelistListener, UploadListener, UploadRequestListener {
private Configuration configuration;
private FreeMule freeMule;
private Action connectAction;
private Action disconnectAction;
private Action nodeAction;
private Action quitAction;
private Action preferencesAction;
private Action sharedDirectoriesAction;
private Action aboutAction;
private Action clearMessagesAction;
private JPanel mainPanel;
private CardLayout cardLayout;
private final String NUMMER1 = "1";
private JPanel ClientsPanel;
private JButton KnownClientsPanelBtn;
private LoggingPreferences loggingPreferences = new LoggingPreferences();
protected JList messageList;
protected DefaultListModel messageListModel = new DefaultListModel();
private StatusPanel statusPanel;
private DownloadFilesPanel downloadFilesPanel;
private UploadFilesPanel uploadFilesPanel;
private KnownClientsPanel knownClientsPanel;
private SharedFilesPanel sharedFilesPanel;
private LoggingPreferencesPanel loggingPreferencesPanel;
private SearchPanel searchPanel;
@SuppressWarnings("unused")
private ServicesPanel servicesPanel;
public MainFrame(FreeMule freeMule) {
super("freeMule " + Version.getVersion());
// try {
// // UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
// // UIManager.setLookAndFeel("javax.swing.plaf.multi.MultiLookAndFeel");
// // UIManager.setLookAndFeel("javax.swing.plaf.synth.SynthLookAndFeel");
// SynthLookAndFeel synthLookAndFeel = new SynthLookAndFeel();
// synthLookAndFeel.load(getClass().getResourceAsStream("/synth-default.xml"), getClass());
// UIManager.setLookAndFeel(synthLookAndFeel);
// // } catch (ClassNotFoundException e) {
// // } catch (InstantiationException e) {
// // } catch (IllegalAccessException e) {
// } catch (UnsupportedLookAndFeelException e) {
// e.printStackTrace();
// } catch (IllegalArgumentException e) {
// e.printStackTrace();
// } catch (ParseException e) {
// e.printStackTrace();
// }
createComponents();
setFreeMule(freeMule);
getContentPane().setLayout(new BorderLayout());
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent) {
actionQuit();
}
});
createActions();
createToolbar();
createContent();
setJMenuBar(createMenuBar());
pack();
setSize(750, 550);
}
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("Freenet");
menuBar.add(fileMenu);
fileMenu.add(connectAction);
fileMenu.add(disconnectAction);
fileMenu.addSeparator();
fileMenu.add(nodeAction);
fileMenu.add(preferencesAction);
fileMenu.add(sharedDirectoriesAction);
fileMenu.addSeparator();
fileMenu.add(quitAction);
JMenu helpMenu = new JMenu("Help");
menuBar.add(helpMenu);
helpMenu.add(aboutAction);
return menuBar;
}
private void createActions() {
connectAction = new AbstractAction("Connect") {
public void actionPerformed(ActionEvent actionEvent) {
actionConnect();
}
};
connectAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/connect_established.png"));
connectAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK));
connectAction.putValue(Action.SHORT_DESCRIPTION, "Start all services and connect to Freenet");
disconnectAction = new AbstractAction("Disconnect") {
public void actionPerformed(ActionEvent actionEvent) {
actionDisconnect();
}
};
disconnectAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/connect_no.png"));
disconnectAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_MASK));
disconnectAction.putValue(Action.SHORT_DESCRIPTION, "Stop all services and disconnect from Freenet");
disconnectAction.setEnabled(false);
preferencesAction = new AbstractAction("Preferences") {
public void actionPerformed(ActionEvent actionEvent) {
actionPreferences();
}
};
preferencesAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/kservices.png"));
preferencesAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK));
preferencesAction.putValue(Action.SHORT_DESCRIPTION, "Change settings");
sharedDirectoriesAction = new AbstractAction("Shared Directories") {
public void actionPerformed(ActionEvent actionEvent) {
actionSharedDirectories();
}
};
sharedDirectoriesAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/preferences3.png"));
sharedDirectoriesAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
sharedDirectoriesAction.putValue(Action.SHORT_DESCRIPTION, "Configure shared directories");
nodeAction = new AbstractAction("Node") {
public void actionPerformed(ActionEvent actionEvent) {
actionNode();
}
};
nodeAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/node3.png"));
nodeAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));
nodeAction.putValue(Action.SHORT_DESCRIPTION, "Configure Freenet node settings");
quitAction = new AbstractAction("Quit") {
public void actionPerformed(ActionEvent actionEvent) {
actionQuit();
}
};
quitAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/exit.png"));
quitAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_MASK));
quitAction.putValue(Action.SHORT_DESCRIPTION, "Quit freeMule");
aboutAction = new AbstractAction("About") {
public void actionPerformed(ActionEvent actionEvent) {
actionAbout();
}
};
aboutAction.putValue(Action.SMALL_ICON, IconLoader.loadIcon("/img/about.png"));
aboutAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
aboutAction.putValue(Action.SHORT_DESCRIPTION, "Shows freeMule version information");
clearMessagesAction = new AbstractAction("Clear Messages") {
public void actionPerformed(ActionEvent actionEvent) {
actionClearMessages();
}
};
clearMessagesAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK));
clearMessagesAction.putValue(Action.SHORT_DESCRIPTION, "Clear the message window");
}
private void createToolbar() {
JToolBar toolbar = new JToolBar();
toolbar.add(connectAction);
toolbar.add(disconnectAction);
toolbar.addSeparator();
toolbar.add(KnownClientsPanelBtn);
toolbar.add(downloadFilesAction);
toolbar.add(uploadFilesAction);
toolbar.add(SearchAction);
toolbar.add(SharedFilesAction);
toolbar.add(loggingAction);
toolbar.add(preferencesAction);
toolbar.add(sharedDirectoriesAction);
toolbar.add(nodeAction);
toolbar.addSeparator();
toolbar.add(quitAction);
getContentPane().add(toolbar, BorderLayout.NORTH);
cardLayout = new CardLayout();
mainPanel.setLayout(cardLayout);
}
private void createComponents() {
statusPanel = new StatusPanel(this);
downloadFilesPanel = new DownloadFilesPanel(this);
uploadFilesPanel = new UploadFilesPanel(this);
searchPanel = new SearchPanel(this);
knownClientsPanel = new KnownClientsPanel(this);
sharedFilesPanel = new SharedFilesPanel(this);
loggingPreferencesPanel = new LoggingPreferencesPanel(this);
// servicesPanel = new ServicesPanel(this);
messageList = new JList(messageListModel);
KnownClientsPanelBtn = new JButton("");
mainPanel = new JPanel();
}
private void createContent() {
JPanel contentPanel = new JPanel(new BorderLayout(12, 12));
contentPanel.setBorder(new EmptyBorder(12, 12, 12, 12));
ClientsPanel.setBorder(BorderFactory.createTitledBorder("Clients"));
mainPanel.add(knownClientsPanel, NUMMER1);
// split pane
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
splitPane.setDividerLocation(0.5);
contentPanel.add(splitPane, BorderLayout.CENTER);
// top frame: tabbed pane
JTabbedPane topTabbed = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
splitPane.setTopComponent(topTabbed);
ImageIcon down = createImageIcon("/img/down2.png");
ImageIcon up = createImageIcon("/img/up.png");
ImageIcon searchtab = createImageIcon("/img/xmag.png");
ImageIcon clientstab = createImageIcon("/img/www.png");
ImageIcon sharedfilestab = createImageIcon("/img/folder_html.png");
ImageIcon logg = createImageIcon("/img/toggle_log.png");
ImageIcon clients = createImageIcon("/img/clients.png");
ImageIcon downloads = createImageIcon("/img/downloads.png");
ImageIcon uploads = createImageIcon("/img/uploads.png");
ImageIcon search = createImageIcon("/img/kview.png");
ImageIcon sharedfiles = createImageIcon("/img/sharedfiles32.png");
ImageIcon logging = createImageIcon("/img/toggle_log32.png");
KnownClientsPanelBtn.setIcon(clients);
KnownClientsPanelBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
KnownClientsPanelBtnActionPerformed(evt);
}
});
// topTabbed.add("Status", statusPanel);
//topTabbed.addTab("Downloads", down, downloadFilesPanel);
//topTabbed.addTab("Uploads", up, uploadFilesPanel);
//topTabbed.addTab("Search", searchtab, searchPanel);
//topTabbed.addTab("Known Clients", clientstab, knownClientsPanel);
//topTabbed.addTab("Shared Files", sharedfilestab, sharedFilesPanel);
//topTabbed.addTab("Logging", logg, loggingPreferencesPanel);
// topTabbed.add("Service Threads", servicesPanel);
// bottom frame: messages
splitPane.setBottomComponent(new JScrollPane(messageList));
splitPane.setResizeWeight(0.9);
// input line
JPanel keyInputPanel = new JPanel(new BorderLayout(5, 5));
contentPanel.add(keyInputPanel, BorderLayout.PAGE_END);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 12, 12));
buttonPanel.setBorder(new EmptyBorder(-12, -12, -12, -12));
buttonPanel.add(new JButton(clearMessagesAction));
keyInputPanel.add(buttonPanel, BorderLayout.LINE_END);
getContentPane().add(contentPanel, BorderLayout.CENTER);
getContentPane().add(mainPanel, BorderLayout.CENTER);
}
private void KnownClientsPanelBtnActionPerformed(ActionEvent evt) {
cardLayout.show(mainPanel, NUMMER1);
}
/**
* @param configuration
* The configuration to set.
*/
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
loggingPreferences = configuration.getLoggingPreferences();
loggingPreferencesPanel.setLoggingPreferences(loggingPreferences);
}