copydialog.java
来自「Rapla是一个灵活的多用户资源管理系统。它提供的一些功能有:日历GUI」· Java 代码 · 共 84 行
JAVA
84 行
/*--------------------------------------------------------------------------*
| Copyright (C) 2006 Christopher Kohlhaas |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by the |
| Free Software Foundation. A copy of the license has been included with |
| these distribution in the COPYING file, if not go to www.fsf.org |
| |
| As a special exception, you are granted the permissions to link this |
| program with every library, which license fulfills the Open Source |
| Definition as published by the Open Source Initiative (OSI). |
*--------------------------------------------------------------------------*/
package org.rapla.plugin.periodcopy;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import org.rapla.components.layout.TableLayout;
import org.rapla.entities.domain.Period;
import org.rapla.framework.RaplaContext;
import org.rapla.framework.RaplaException;
import org.rapla.gui.RaplaGUIComponent;
import org.rapla.gui.toolkit.RaplaWidget;
/** sample UseCase that only displays the text of the configuration and
all reservations of the user.*/
class CopyDialog extends RaplaGUIComponent implements RaplaWidget
{
JComboBox sourcePeriodChooser = new JComboBox(new String[] {"a", "b"});
JComboBox destPeriodChooser = new JComboBox(new String[] {"a", "b"});
JPanel panel = new JPanel();
JLabel label = new JLabel();
JList selectedReservations = new JList();
public final static String ROLE = CopyDialog.class.getName();
public CopyDialog(RaplaContext sm) throws RaplaException {
super(sm);
setChildBundleName( PeriodCopyPlugin.RESOURCE_FILE);
Period[] periods = getQuery().getPeriods();
sourcePeriodChooser.setModel( new DefaultComboBoxModel( periods ));
destPeriodChooser.setModel( new DefaultComboBoxModel( periods ));
label.setText(getString("copy_selected_events_from"));
panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
panel.setLayout(new TableLayout(new double[][]{
{TableLayout.PREFERRED ,5 , TableLayout.FILL }
,{20, 5, TableLayout.PREFERRED ,5 ,TableLayout.PREFERRED, 5, TableLayout.PREFERRED }
}
));
selectedReservations.setEnabled( false );
panel.add(label, "0,0,2,1");
panel.add( new JLabel(getString("source")),"0,2" );
panel.add( sourcePeriodChooser,"2,2" );
panel.add( new JLabel(getString("destination")),"0,4" );
panel.add( destPeriodChooser,"2,4" );
panel.add( new JLabel(getString("reservations")) , "0,6,l,t");
panel.add( new JScrollPane( selectedReservations ),"2,6" );
}
public JComboBox getDestChooser() {
return destPeriodChooser;
}
public JComboBox getSourceChooser() {
return sourcePeriodChooser;
}
public JList getReservationList() {
return selectedReservations;
}
public JComponent getComponent() {
return panel;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?