:shock:JAVAn00b hat gesagt.:Wenn ich ein fenster öffne dann bleibt der immer vorne und das aktive fenster ist hinten.
:shock: :shock: :shock:JAVAn00b hat gesagt.:wenn ich ein fenster ausziehen möchte springt er immer zu seinem ursprungsort zurück.
Hobbit_Im_Blutrausch hat gesagt.:
Leroy42 hat gesagt.:Hobbit_Im_Blutrausch hat gesagt.:
Trau' dem nicht! Sein Laptop spinnt heute soviel 'rum, daß er dir kaum helfen kann.
:bae: :bae: :bae:
( )
Vielleicht mal den Laptop 'drag'n'droppen'? :bae:Hobbit_Im_Blutrausch hat gesagt.:Und das macht mein Laptop regelmäßig :cry:
/*
* MainFrame.java
*
* Created on 28. November 2006, 20:12
*
*/
package frames;
/**
*
* @author Gentleman
*
*/
import java.awt.*;
import java.awt.event.*;
import java.awt.Component.*;
import clientContent.*;
import mealContent.*;
import javax.swing.*;
import helpContent.*;
import helpContent.*;
import mainDialog.*;
import java.io.*;
import java.net.*;
public class AdminFrame extends JFrame implements ActionListener {
private JMenuBar menuB_main = new JMenuBar();
private JMenu menu_data = new JMenu("Datei");
private JMenuItem menuI_close = new JMenuItem("Schließen");
private JMenuItem menuI_quit = new JMenuItem("Beenden");
private JMenu menu_Client = new JMenu("Kunde");
private JMenuItem menuI_clientList = new JMenuItem("Kunden Liste");
private JMenuItem menuI_newClient = new JMenuItem("Kunde Neu");
private JMenuItem menuI_changeClient = new JMenuItem("Kundenstamm");
private JMenuItem menuI_searchClient = new JMenuItem("Kunde Suchen");
private JMenu menu_Meal = new JMenu("Lebensmittel");
private JMenuItem menuI_mealList = new JMenuItem("Lebensmittel Liste");
private JMenuItem menuI_newMeal = new JMenuItem("Lebensmittel Neu");
private JMenuItem menuI_changeMeal = new JMenuItem("Lebensmittelstamm");
private JMenuItem menuI_searchMeal = new JMenuItem("Lebensmittel Suchen");
private JMenu menu_search = new JMenu("Search");
private JMenuItem menuI_sClient = new JMenuItem("Kunden");
private JMenuItem menuI_sMeal = new JMenuItem("Lebensmittel");
private JMenu menu_list = new JMenu("Listen");
private JMenuItem menuI_lClient = new JMenuItem("Kundestamm");
private JMenuItem menuI_lMeal = new JMenuItem("Nahrungstabelle");
private JMenu menu_calc = new JMenu("Nährwertberechner");
private JMenuItem menuI_newCalc = new JMenuItem("Neu");
private JMenu menu_help = new JMenu("Hilfe");
private JMenuItem menuI_faq = new JMenuItem("FAQ");
private JMenuItem menuI_manual = new JMenuItem("Benutzerhandbuch");
private JMenuItem menuI_contact = new JMenuItem("Kontakt");
private JMenuItem menuI_about = new JMenuItem("About");
private JLabel label_title = new JLabel();
private JLabel label_status = new JLabel();
private JLabel label_desc = new JLabel("Beschreibung");
private JPanel panel_west = new JPanel();
private JDesktopPane panel_center = new JDesktopPane();
private JPanel panel_east = new JPanel();
private JPanel panel_south = new JPanel();
private JScrollPane jScrollPane1 = new JScrollPane();
private JEditorPane txta_desc = new JEditorPane();
private JEditorPane txta_welcome = new JEditorPane();
private JScrollPane jScrollPane11 = new JScrollPane();
private JProgressBar progBar = new JProgressBar();
private JInternalFrame internFrame = new JInternalFrame("Welcome", true, true, true, true);
private Dimension dim;
private Welcome wel = new Welcome();
/*
* Creates a new instance of MainFrame
*/
public AdminFrame(String name) {
setFrame();
setMenuBar();
setTitle(name);
}
public AdminFrame() {
setTitle("Ernährungsberater");
setMenuBar();
setFrame();
panel_center.add(wel);
}
/**
*Hier wird die Fenstergröße erstellt;
*/
public void setFrameSize() {
dim = Toolkit.getDefaultToolkit().getScreenSize();
setSize(dim.width - 50, dim.height - 50);
setLocation( (dim.width - getSize().width ) / 2, (dim.height- getSize().height) / 2 - 20);
}
public void setFrame() {
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0); }});
AdminFrame.setDefaultLookAndFeelDecorated(true);
setFrameSize();
setLayout(new BorderLayout());
label_title.setFont(new Font("Arial", Font.ROMAN_BASELINE, 18));
label_title.setHorizontalTextPosition(SwingConstants.CENTER);
panel_east.setLayout(new BorderLayout());
jScrollPane11.setViewportView(txta_welcome);
jScrollPane1.setViewportView(txta_desc);
txta_desc.setEditable(false);
label_desc.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
panel_east.add(jScrollPane1);
panel_east.add(label_desc, BorderLayout.NORTH);
panel_south.setLayout(new GridLayout(1,1));
panel_south.add(progBar, BorderLayout.SOUTH);
// txta_welcome.setEditable(false);
// txta_welcome.setBorder(null);
// internFrame.add(txta_welcome);
// panel_center.add(internFrame);
// panel_center.add(txta_welcome);
add(panel_center, BorderLayout.CENTER);
add(label_title, BorderLayout.NORTH);
add(panel_south, BorderLayout.SOUTH);
add(panel_east, BorderLayout.EAST);
}
public void setMenuBar() {
setJMenuBar(menuB_main);
menuB_main.add(menu_data);
menu_data.add(menuI_close);
menuI_close.addActionListener(this);
menu_data.addSeparator();
menu_data.add(menuI_quit);
menuI_quit.addActionListener(this);
menuB_main.add(menu_Client);
menu_Client.add(menuI_newClient);
menuI_newClient.addActionListener(this);
menu_Client.add(menuI_clientList);
menuI_clientList.addActionListener(this);
menu_Client.add(menuI_changeClient);
menuI_changeClient.addActionListener(this);
menuB_main.add(menu_Meal);
menu_Meal.add(menuI_newMeal);
menuI_newMeal.addActionListener(this);
menu_Meal.add(menuI_mealList);
menuI_mealList.addActionListener(this);
menu_Meal.add(menuI_changeMeal);
menuI_changeMeal.addActionListener(this);
menuB_main.add(menu_calc);
menu_calc.add(menuI_newCalc);
menuI_newCalc.addActionListener(this);
menuB_main.add(menu_help);
menu_help.add(menuI_manual);
menuI_manual.addActionListener(this);
menu_help.add(menuI_faq);
menuI_faq.addActionListener(this);
menu_help.add(menuI_contact);
menuI_contact.addActionListener(this);
menu_help.add(menuI_about);
menuI_about.addActionListener(this);
/**
* menuB_main.add(menu_list);
* menu_list.add(menuI_newClient);
* menuI_newClient.addActionListener(this);
* menu_list.add(menuI_lMeal);
* menuI_lMeal.addActionListener(this);
*/
/**
* menuB_main.add(menu_search);
* menu_search.add(menuI_sClient);
* menuI_sClient.addActionListener(this);
* menu_search.add(menuI_sMeal);
* menuI_sMeal.addActionListener(this);
*/
}
private void clearPanelCenter() {
panel_center.removeAll();
}
private void refreshPanelCenter() {
validate();
repaint();
}
public void actionPerformed(ActionEvent ae) {
Object event = ae.getSource();
if(event == menuI_newCalc) {
NewNutrientCalc nnc = new NewNutrientCalc();
panel_center.add(nnc);
}
if(event == menuI_newClient) {
// clearPanelCenter();
NewClient newC = new NewClient();
panel_center.add(newC);
refreshPanelCenter();
}
if(event == menuI_clientList) {
// clearPanelCenter();
ClientList cl = new ClientList();
panel_center.add(cl);
refreshPanelCenter();
}
if(event == menuI_changeClient) {
// clearPanelCenter();
ClientChange cl = new ClientChange();
panel_center.add(cl);
refreshPanelCenter();
}
if(event == menuI_manual) {
// clearPanelCenter();
ReadMe rm = new ReadMe();
panel_center.add(rm);
refreshPanelCenter();
}
if(event == menuI_mealList) {
// clearPanelCenter();
MealList ml = new MealList();
panel_center.add(ml);
refreshPanelCenter();
}
if(event == menuI_newMeal) {
// clearPanelCenter();
NewMeal nm = new NewMeal();
panel_center.add(nm);
refreshPanelCenter();
}
if(event == menuI_changeMeal) {
// clearPanelCenter();
ChangeMeal cm = new ChangeMeal();
panel_center.add(cm);
refreshPanelCenter();
}
if(event == menuI_contact) {
// clearPanelCenter();
Contakt co = new Contakt();
panel_center.add(co);
refreshPanelCenter();
}
if(event == menuI_about) {
// clearPanelCenter();
About ab = new About();
panel_center.add(ab);
refreshPanelCenter();
}
if(event == menuI_close) {
panel_center.removeAll();
panel_center.repaint();
}
if(event == menuI_quit) {
System.exit(0);
}
}
public static void main(String args[]) {
AdminFrame af = new AdminFrame();
af.setVisible(true);
}
}
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.JInternalFrame.show(JInternalFrame.java:1642)
at java.awt.Component.show(Component.java:1300)
at java.awt.Component.setVisible(Component.java:1253)
at javax.swing.JComponent.setVisible(JComponent.java:2535)
at clientContent.ClientList.initComponents(ClientList.java:52)
at clientContent.ClientList.<init>(ClientList.java:23)
at frames.AdminFrame.actionPerformed(AdminFrame.java:236)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
import javax.swing.*;
public class Test {
public static void main(String[] args) {
JFrame frame = new JFrame();
JDesktopPane pane = new JDesktopPane();
JInternalFrame eins = new JInternalFrame();
JInternalFrame zwei = new JInternalFrame();
eins.setSize(300, 300);
zwei.setSize(400, 100);
frame.setContentPane(pane);
pane.add(eins);
pane.add(zwei);
eins.setVisible(true);
zwei.setVisible(true);
frame.setSize(500, 500);
frame.setVisible(true);
}
}
setClosable(true);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
setTitle("Kontakt");
setVisible(true);
panel_north.setLayout(new java.awt.BorderLayout());
panel_data.setLayout(new java.awt.GridLayout(5, 2));
public class Contakt extends javax.swing.JInternalFrame
JAVAn00b hat gesagt.:ja ist alles drinne vorhanden!
package mealContent;
/*
* NewJPanel.java
*
* Created on 5. Dezember 2006, 09:54
*/
/**
*
*
*/
public class NewMeal extends javax.swing.JInternalFrame
{
/** Creates new form NewJPanel */
public NewMeal ()
{
initComponents ();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
buttonGroup2 = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
label_name = new javax.swing.JLabel();
txtf_name = new javax.swing.JTextField();
label_kcal = new javax.swing.JLabel();
txtf_kcal = new javax.swing.JTextField();
label_fat = new javax.swing.JLabel();
txtf_fat = new javax.swing.JTextField();
label_protein = new javax.swing.JLabel();
txtf_protein = new javax.swing.JTextField();
label_carbohydrates = new javax.swing.JLabel();
txtf_carbohydrates = new javax.swing.JTextField();
label_info = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
txtf_info = new javax.swing.JEditorPane();
jPanel2 = new javax.swing.JPanel();
btn_save = new javax.swing.JButton();
btn_clear = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
setClosable(true);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
setTitle("Lebensmittel Neu");
setMinimumSize(new java.awt.Dimension(800, 600));
setPreferredSize(new java.awt.Dimension(800, 600));
setVisible(true);
jPanel1.setLayout(new java.awt.BorderLayout());
jPanel1.setMinimumSize(new java.awt.Dimension(160, 180));
jPanel1.setPreferredSize(new java.awt.Dimension(160, 180));
jPanel5.setLayout(new java.awt.GridLayout(9, 2));
label_name.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
label_name.setText("Name");
jPanel5.add(label_name);
txtf_name.setText(" ");
jPanel5.add(txtf_name);
label_kcal.setText("Kcal");
jPanel5.add(label_kcal);
txtf_kcal.setText(" ");
jPanel5.add(txtf_kcal);
label_fat.setText("Fett");
jPanel5.add(label_fat);
txtf_fat.setText(" ");
jPanel5.add(txtf_fat);
label_protein.setText("Eiwei\u00df");
jPanel5.add(label_protein);
txtf_protein.setText(" ");
jPanel5.add(txtf_protein);
label_carbohydrates.setText("Kohlenhydrate");
jPanel5.add(label_carbohydrates);
txtf_carbohydrates.setText(" ");
jPanel5.add(txtf_carbohydrates);
label_info.setText("Info");
jPanel5.add(label_info);
jPanel4.setLayout(new java.awt.GridLayout(1, 1));
jScrollPane1.setViewportView(txtf_info);
jPanel4.add(jScrollPane1);
jPanel5.add(jPanel4);
jPanel1.add(jPanel5, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
btn_save.setText("Speichern");
btn_save.setToolTipText("Hier spiechern Sie Ihre Daten in die Datenbank.");
btn_save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_saveActionPerformed(evt);
}
});
jPanel2.add(btn_save);
btn_clear.setText("Leeren");
btn_clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_clearActionPerformed(evt);
}
});
jPanel2.add(btn_clear);
getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
jPanel3.setLayout(new java.awt.BorderLayout());
jLabel1.setFont(new java.awt.Font("Arial", 1, 18));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Lebensmittel Neu");
jPanel3.add(jLabel1, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel3, java.awt.BorderLayout.NORTH);
}// </editor-fold>
private void btn_saveActionPerformed (java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:
}
private void btn_clearActionPerformed (java.awt.event.ActionEvent evt)
{
// TODO add your handling code here:
txtf_name.setText(" ");
txtf_kcal.setText(" ");
txtf_fat.setText(" ");
txtf_protein.setText(" ");
txtf_carbohydrates.setText(" ");
txtf_info.setText(" ");
}
// Variables declaration - do not modify
private javax.swing.JButton btn_clear;
private javax.swing.JButton btn_save;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel label_carbohydrates;
private javax.swing.JLabel label_fat;
private javax.swing.JLabel label_info;
private javax.swing.JLabel label_kcal;
private javax.swing.JLabel label_name;
private javax.swing.JLabel label_protein;
private javax.swing.JTextField txtf_carbohydrates;
private javax.swing.JTextField txtf_fat;
private javax.swing.JEditorPane txtf_info;
private javax.swing.JTextField txtf_kcal;
private javax.swing.JTextField txtf_name;
private javax.swing.JTextField txtf_protein;
// End of variables declaration
}