| File |
Line |
| org/jcurl/demo/smack/JCurlSmackClient.java |
88
|
| org/jcurl/demo/tactics/JCurlShotPlanner.java |
150
|
private static final Insets zeroInsets = new Insets(0, 0, 0, 0);
private final ApplicationContext act;;
public GuiUtil(final ApplicationContext act) {
this.act = act;
}
/**
* Create a simple about box JDialog that displays the standard
* Application resources, like {@code Application.title} and
* {@code Application.description}. The about box's labels and fields
* are configured by resources that are injected when the about box is
* shown (see SingleFrameApplication#show). The resources are defined in
* the application resource file: resources/DocumentExample.properties.
*
* From:
* https://appframework.dev.java.net/downloads/AppFramework-1.03-src.zip
* DocumentExample
*/
private JDialog createAboutBox(final Frame owner) {
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(new EmptyBorder(0, 28, 16, 28)); // top, left,
// bottom, right
final JLabel titleLabel = new JLabel();
titleLabel.setName("aboutTitleLabel");
final GridBagConstraints c = new GridBagConstraints();
initGridBagConstraints(c);
c.anchor = GridBagConstraints.WEST;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.HORIZONTAL;
c.ipady = 32;
c.weightx = 1.0;
panel.add(titleLabel, c);
final String[] fields = { "description", "version", "vendor",
"home" };
for (final String field : fields) {
final JLabel label = new JLabel();
label.setName(field + "Label");
initGridBagConstraints(c);
// c.anchor = GridBagConstraints.BASELINE_TRAILING; 1.6 ONLY
c.anchor = GridBagConstraints.EAST;
panel.add(label, c);
initGridBagConstraints(c);
c.weightx = 1.0;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.HORIZONTAL;
final JTextField textField = new JTextField();
textField.setName(field + "TextField");
textField.setEditable(false);
textField.setBorder(null);
panel.add(textField, c);
}
final JButton closeAboutButton = new JButton();
closeAboutButton.setAction(findAction("closeAboutBox"));
initGridBagConstraints(c);
c.anchor = GridBagConstraints.EAST;
c.gridx = 1;
panel.add(closeAboutButton, c);
final JDialog dialog = new JDialog(owner);
dialog.setName("aboutDialog");
dialog.add(panel, BorderLayout.CENTER);
return dialog;
}
private JFileChooser createFileChooser(final File base,
final String resourceName, final FileFilter filter) {
final JFileChooser fc = new JFileChooser(base);
fc.setName(resourceName);
fc.setMultiSelectionEnabled(false);
fc.setAcceptAllFileFilterUsed(true);
fc.setFileFilter(filter);
getContext().getResourceMap().injectComponents(fc);
return fc;
}
private FileNameExtensionFilter createFileFilter(
final String resourceName, final String... extensions) {
final ResourceMap appResourceMap = getContext().getResourceMap();
final String key = resourceName + ".description";
final String desc = appResourceMap.getString(key);
return new FileNameExtensionFilter(desc == null ? key : desc,
extensions);
}
private JMenu createMenu(final String menuName,
final String[] actionNames) {
|
| File |
Line |
| org/jcurl/demo/tactics/TrajectoryPiccoloBean.java |
259
|
| org/jcurl/demo/tactics/TrajectoryScenarioBean.java |
251
|
}
@Override
public void setChanger(final ChangeManager changer) {
super.setChanger(changer);
broom.setChanger(changer);
}
@Override
public void setCurves(final ComputedTrajectorySet curves) {
// rocks.setVisible(model != null);
if (this.curves != null) {
removeCL(this.curves.getInitialPos());
removeCL(this.curves.getCurrentPos());
}
this.curves = curves;
r2n.clear();
if (this.curves != null) {
final RockSet<Pos> ip = this.curves.getInitialPos();
final RockSet<Pos> cp = this.curves.getCurrentPos();
addCL(ip);
addCL(cp);
for (int i16 = RockSet.ROCKS_PER_SET - 1; i16 >= 0; i16--) {
syncM2V(ip, i16, initial[i16]);
syncM2V(cp, i16, current[i16]);
syncM2V(getCurves(), i16, path, tf);
}
}
tt.init(this.curves);
rocks.setVisible(this.curves != null);
}
public void setZoom(final RectangularShape viewport,
|
| File |
Line |
| org/jcurl/demo/smack/JCurlSmackClient.java |
195
|
| org/jcurl/demo/tactics/JCurlShotPlanner.java |
244
|
menuItem.setAction(findAction(actionName));
menuItem.setIcon(null);
menu.add(menuItem);
}
return menu;
}
private File ensureSuffix(final File dst,
final FileNameExtensionFilter pat) {
if (pat.accept(dst))
return dst;
return new File(dst.getAbsoluteFile() + "."
+ pat.getExtensions()[0]);
}
private javax.swing.Action findAction(final String actionName) {
return getContext().getActionMap().get(actionName);
};
public ApplicationContext getContext() {
return act;
};
private void initGridBagConstraints(final GridBagConstraints c) {
c.anchor = GridBagConstraints.CENTER;
c.fill = GridBagConstraints.NONE;
c.gridwidth = 1;
c.gridheight = 1;
c.gridx = GridBagConstraints.RELATIVE;
c.gridy = GridBagConstraints.RELATIVE;
c.insets = zeroInsets;
c.ipadx = 4; // not the usual default
c.ipady = 4; // not the usual default
c.weightx = 0.0;
c.weighty = 0.0;
};
}
|
| File |
Line |
| org/jcurl/demo/tactics/JCurlShotPlanner.java |
317
|
| org/jcurl/demo/tactics/old/MenuView.java |
53
|
private static final Rectangle2D TwelvePlus;
static {
final double r2 = 2 * RockProps.DEFAULT.getRadius();
final double x = IceSize.SIDE_2_CENTER + r2;
HousePlus = new Rectangle2D.Double(-x, -(IceSize.HOG_2_TEE + r2),
2 * x, IceSize.HOG_2_TEE + IceSize.BACK_2_TEE + 3 * r2 + 2 * r2);
final double c12 = r2 + Unit.f2m(6.0);
TwelvePlus = new Rectangle2D.Double(-c12, -c12, 2 * c12, 2 * c12);
|