Добавлен набросок второго задания

This commit is contained in:
Victor 2013-11-25 23:52:39 +02:00
parent 002c7f1868
commit 5e7c347e16
5 changed files with 372 additions and 2 deletions

View File

@ -29,7 +29,8 @@ endorsed.classpath=
excludes=
includes=**
jar.compress=false
javac.classpath=
javac.classpath=\
${libs.absolutelayout.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

View File

@ -1,5 +1,6 @@
package tse;
import tse.lr4.DailyPad;
import tse.lr4.LoginWindow;
@ -20,7 +21,7 @@ public class LR_4 implements ILabRab {
new LoginWindow().setVisible(true);
break;
case 1:
new DailyPad().setVisible(true);
break;
}
}

96
src/tse/lr4/DailyPad.java Normal file
View File

@ -0,0 +1,96 @@
package tse.lr4;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JToolBar;
import javax.swing.UIManager;
/**
* Ежедневник.
* @author aNNiMON
*/
public class DailyPad extends JFrame {
private PadPanel panel;
public DailyPad() {
super("DailyPad");
setLocationByPlatform(true);
setDefaultCloseOperation(HIDE_ON_CLOSE);
addMenu();
addToolBar();
panel = new PadPanel();
add(panel, BorderLayout.CENTER);
pack();
}
private void addMenu() {
JMenuBar mainMenu = new JMenuBar();
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic(KeyEvent.VK_F);
JMenuItem newMenuItem = new JMenuItem("New");
newMenuItem.setMnemonic(KeyEvent.VK_N);
newMenuItem.addActionListener(newActionListener);
fileMenu.add(newMenuItem);
fileMenu.add(new JMenuItem("Open"));
JMenuItem saveMenuItem = new JMenuItem("Save");
saveMenuItem.setMnemonic(KeyEvent.VK_S);
saveMenuItem.addActionListener(openActionListener);
fileMenu.add(saveMenuItem);
fileMenu.add(new JMenuItem("Save As"));
JMenuItem exitMenuItem = new JMenuItem("Exit");
exitMenuItem.setMnemonic(KeyEvent.VK_X);
exitMenuItem.addActionListener(exitActionListener);
fileMenu.add(exitMenuItem);
mainMenu.add(fileMenu);
JMenu helpMenu = new JMenu("Help");
helpMenu.add(new JMenuItem("About"));
mainMenu.add(helpMenu);
setJMenuBar(mainMenu);
}
private void addToolBar() {
JToolBar toolbar = new JToolBar();
JButton newButton = new JButton(UIManager.getIcon("Tree.collapsedIcon"));
newButton.addActionListener(newActionListener);
toolbar.add(newButton);
JButton openButton = new JButton(UIManager.getIcon("Tree.openIcon"));
openButton.addActionListener(openActionListener);
toolbar.add(openButton);
JButton exitButton = new JButton(UIManager.getIcon("FileChooser.upFolderIcon"));
exitButton.addActionListener(exitActionListener);
toolbar.add(exitButton);
add(toolbar, BorderLayout.NORTH);
}
private final ActionListener newActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
};
private final ActionListener openActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
};
private final ActionListener exitActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
};
}

142
src/tse/lr4/PadPanel.form Normal file
View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="eventLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="eventName" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="descriptionLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="dateTimeLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="dateSpinner" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="importantCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="prevButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Component id="applyButton" pref="159" max="32767" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Component id="nextButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="eventLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="eventName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="descriptionLabel" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="80" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="dateSpinner" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="dateTimeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="importantCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="prevButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="nextButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="applyButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="eventLabel">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41d;&#x430;&#x437;&#x432;&#x430;&#x43d;&#x438;&#x435; &#x441;&#x43e;&#x431;&#x44b;&#x442;&#x438;&#x44f;:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="eventName">
</Component>
<Component class="javax.swing.JLabel" name="descriptionLabel">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41e;&#x43f;&#x438;&#x441;&#x430;&#x43d;&#x438;&#x435;:"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="descriptionTextArea">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="dateTimeLabel">
<Properties>
<Property name="text" type="java.lang.String" value="&#x414;&#x430;&#x442;&#x430; / &#x432;&#x440;&#x435;&#x43c;&#x44f;:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="dateSpinner">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="now" stepSize="2" type="date"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="importantCheckBox">
<Properties>
<Property name="text" type="java.lang.String" value="&#x412;&#x430;&#x436;&#x43d;&#x43e;&#x435;"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="applyButton">
<Properties>
<Property name="text" type="java.lang.String" value="&#x41f;&#x440;&#x438;&#x43c;&#x435;&#x43d;&#x438;&#x442;&#x44c;"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="prevButton">
<Properties>
<Property name="text" type="java.lang.String" value="&lt;&lt;"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="nextButton">
<Properties>
<Property name="text" type="java.lang.String" value="&gt;&gt;"/>
</Properties>
</Component>
</SubComponents>
</Form>

130
src/tse/lr4/PadPanel.java Normal file
View File

@ -0,0 +1,130 @@
/*
*/
package tse.lr4;
import java.util.Calendar;
import java.util.Date;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SpinnerDateModel;
/**
*
* @author aNNiMON
*/
public class PadPanel extends javax.swing.JPanel {
/**
* Creates new form PadPanel
*/
public PadPanel() {
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.
*/
@SuppressWarnings("unchecked")
private void initComponents() {//GEN-BEGIN:initComponents
JLabel eventLabel = new JLabel();
JTextField eventName = new JTextField();
JLabel descriptionLabel = new JLabel();
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea descriptionTextArea = new JTextArea();
JLabel dateTimeLabel = new JLabel();
JSpinner dateSpinner = new JSpinner();
JCheckBox importantCheckBox = new JCheckBox();
JButton applyButton = new JButton();
JButton prevButton = new JButton();
JButton nextButton = new JButton();
eventLabel.setText("Название события:");
descriptionLabel.setText("Описание:");
descriptionTextArea.setColumns(20);
descriptionTextArea.setRows(5);
jScrollPane1.setViewportView(descriptionTextArea);
dateTimeLabel.setText("Дата / время:");
dateSpinner.setModel(new SpinnerDateModel(new Date(), null, null, Calendar.MONTH));
importantCheckBox.setText("Важное");
applyButton.setText("Применить");
prevButton.setText("<<");
nextButton.setText(">>");
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(eventLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(eventName, GroupLayout.PREFERRED_SIZE, 1, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(descriptionLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1))
.addGroup(layout.createSequentialGroup()
.addComponent(dateTimeLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(dateSpinner)
.addGap(18, 18, 18)
.addComponent(importantCheckBox))
.addGroup(layout.createSequentialGroup()
.addComponent(prevButton)
.addGap(18, 18, 18)
.addComponent(applyButton, GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(nextButton)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(eventLabel)
.addComponent(eventName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(descriptionLabel)
.addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE))
.addGap(9, 9, 9)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(dateSpinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(dateTimeLabel)
.addComponent(importantCheckBox))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(prevButton)
.addComponent(nextButton)
.addComponent(applyButton))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}