use of java.awt.event.ActionListener in project gradle by gradle.
the class SearchPanel method setupUI.
private void setupUI() {
mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS));
isCaseSensitiveCheckBox = new JCheckBox("Case Sensitive");
isCaseSensitiveCheckBox.setMnemonic('c');
isCaseSensitiveCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestSearch();
}
});
useRegularExpressionsCheckBox = new JCheckBox("Regular Expression");
useRegularExpressionsCheckBox.setMnemonic('r');
useRegularExpressionsCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
requestSearch();
}
});
findNextButton = Utility.createButton(getClass(), "/org/gradle/gradleplugin/userinterface/swing/generic/tabs/move-down.png", "Find Next Match", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
goToNextMatch();
}
});
findPreviousButton = Utility.createButton(getClass(), "/org/gradle/gradleplugin/userinterface/swing/generic/tabs/move-up.png", "Find Previous Match", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
goToPreviousMatch();
}
});
JButton closeButton = Utility.createButton(getClass(), "/org/gradle/gradleplugin/userinterface/swing/generic/close.png", "Close Search Panel", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
mainPanel.add(createTextToMatchField());
mainPanel.add(Box.createHorizontalStrut(5));
mainPanel.add(findPreviousButton);
mainPanel.add(Box.createHorizontalStrut(5));
mainPanel.add(findNextButton);
mainPanel.add(Box.createHorizontalStrut(5));
mainPanel.add(isCaseSensitiveCheckBox);
mainPanel.add(Box.createHorizontalStrut(5));
mainPanel.add(useRegularExpressionsCheckBox);
addAdditionalFields(mainPanel);
mainPanel.add(Box.createHorizontalGlue());
mainPanel.add(closeButton);
}
use of java.awt.event.ActionListener in project libgdx by libgdx.
the class EditorPanel method initializeComponents.
protected void initializeComponents() {
setLayout(new GridBagLayout());
{
titlePanel = new JPanel(new GridBagLayout());
add(titlePanel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 0, 3, 0), 0, 0));
titlePanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
{
nameLabel = new JLabel(name);
titlePanel.add(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));
nameLabel.setFont(nameLabel.getFont().deriveFont(Font.BOLD));
}
{
descriptionLabel = new JLabel(description);
titlePanel.add(descriptionLabel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 6, 3, 6), 0, 0));
}
{
advancedButton = new JToggleButton("Advanced");
titlePanel.add(advancedButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
advancedButton.setVisible(false);
}
{
activeButton = new JToggleButton("Active");
titlePanel.add(activeButton, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
}
{
removeButton = new JButton("X");
titlePanel.add(removeButton, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
}
}
{
contentPanel = new JPanel(new GridBagLayout());
add(contentPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 6, 6, 6), 0, 0));
contentPanel.setVisible(false);
}
{
advancedPanel = new JPanel(new GridBagLayout());
add(advancedPanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 6, 6, 6), 0, 0));
advancedPanel.setVisible(false);
}
titlePanel.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event) {
if (!isAlwaysShown)
showContent(!contentPanel.isVisible());
}
});
activeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
activate();
}
});
advancedButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
advancedPanel.setVisible(advancedButton.isSelected());
}
});
removeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
removePanel();
}
});
}
use of java.awt.event.ActionListener in project libgdx by libgdx.
the class EditorPanel method setValue.
protected static void setValue(JCheckBox checkBox, boolean isSelected) {
ActionListener[] listeners = checkBox.getActionListeners();
ActionListener listener = null;
if (listeners != null && listeners.length > 0) {
listener = listeners[0];
checkBox.removeActionListener(listener);
}
checkBox.setSelected(isSelected);
if (listener != null)
checkBox.addActionListener(listener);
}
use of java.awt.event.ActionListener in project libgdx by libgdx.
the class DynamicsInfluencerPanel method initializeComponents.
protected void initializeComponents() {
super.initializeComponents();
JPanel velocitiesPanel = new JPanel();
velocitiesPanel.setLayout(new GridBagLayout());
{
JPanel sideButtons = new JPanel(new GridBagLayout());
velocitiesPanel.add(sideButtons, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
{
sideButtons.add(velocityBox = new JComboBox(new DefaultComboBoxModel()), new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
}
{
JButton newButton = new JButton("New");
sideButtons.add(newButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
newButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
createVelocity(velocityBox.getSelectedItem());
}
});
}
{
JButton deleteButton = new JButton("Delete");
sideButtons.add(deleteButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
deleteVelocity();
}
});
}
}
JScrollPane scroll = new JScrollPane();
velocitiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
velocityTable = new JTable() {
public Class getColumnClass(int column) {
return column == 1 ? Boolean.class : super.getColumnClass(column);
}
@Override
public Dimension getPreferredScrollableViewportSize() {
Dimension dim = super.getPreferredScrollableViewportSize();
dim.height = getPreferredSize().height;
return dim;
}
};
velocityTable.getTableHeader().setReorderingAllowed(false);
velocityTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scroll.setViewportView(velocityTable);
velocityTableModel = new DefaultTableModel(new String[0][0], new String[] { "Velocity", "Active" });
velocityTable.setModel(velocityTableModel);
velocityTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent event) {
if (event.getValueIsAdjusting())
return;
velocitySelected();
}
});
velocityTableModel.addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent event) {
if (event.getColumn() != 1)
return;
velocityChecked(event.getFirstRow(), (Boolean) velocityTable.getValueAt(event.getFirstRow(), 1));
}
});
//Velocity values
emptyPanel = new ParticleValuePanel(editor, "", "", true, false);
strengthVelocityPanel = new StrengthVelocityPanel(editor, null, "Life", "", "");
angularVelocityPanel = new AngularVelocityPanel(editor, null, "Life", "", "");
strengthVelocityPanel.setVisible(false);
angularVelocityPanel.setVisible(false);
emptyPanel.setVisible(false);
strengthVelocityPanel.setIsAlwayShown(true);
angularVelocityPanel.setIsAlwayShown(true);
emptyPanel.setIsAlwayShown(true);
emptyPanel.setValue(null);
//Assemble
int i = 0;
addContent(i++, 0, velocitiesPanel);
addContent(i++, 0, strengthVelocityPanel);
addContent(i++, 0, angularVelocityPanel);
addContent(i++, 0, emptyPanel);
}
use of java.awt.event.ActionListener in project libgdx by libgdx.
the class AngularVelocityPanel method initializeComponents.
private void initializeComponents(DynamicsModifier.Angular aValue, String charTitle) {
JPanel contentPanel = getContentPanel();
{
JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
{
contentPanel.add(magnitudePanel = new ScaledNumericPanel(editor, aValue == null ? null : aValue.strengthValue, charTitle, "Strength", "In world units per second.", true), new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
}
{
contentPanel.add(phiPanel = new ScaledNumericPanel(editor, aValue == null ? null : aValue.phiValue, charTitle, "Azimuth", "Rotation starting on Y", true), new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
}
{
contentPanel.add(thetaPanel = new ScaledNumericPanel(editor, aValue == null ? null : aValue.thetaValue, charTitle, "Polar angle", "around Y axis on XZ plane", true), new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
}
{
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
magnitudePanel.setIsAlwayShown(true);
phiPanel.setIsAlwayShown(true);
thetaPanel.setIsAlwayShown(true);
isGlobalCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
AngularVelocityPanel.this.value.isGlobal = isGlobalCheckBox.isSelected();
}
});
}
Aggregations