58 lines
1.6 KiB
Java
58 lines
1.6 KiB
Java
package action;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
import java.awt.event.KeyEvent;
|
|
|
|
import javax.swing.AbstractAction;
|
|
import javax.swing.Action;
|
|
import javax.swing.Box;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JOptionPane;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JTextField;
|
|
import javax.swing.KeyStroke;
|
|
|
|
import cXML.node;
|
|
|
|
public class actTitre2 extends AbstractAction{
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
{
|
|
putValue( Action.NAME, "Titre 2 (SHIFT+2)" );
|
|
putValue( Action.SHORT_DESCRIPTION, "Titre 2 dans le feedback" );
|
|
putValue( Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_2, KeyEvent.SHIFT_DOWN_MASK ) );
|
|
}
|
|
@Override
|
|
public void actionPerformed(ActionEvent e) {
|
|
node nod = (node) fenetres.create.getSelectNode().getUserObject();
|
|
String titre = "";
|
|
if(nod.getAttributs().get("titre2")!=null) {
|
|
titre = nod.getAttributs().get("titre2");
|
|
}
|
|
|
|
|
|
JTextField xField = new JTextField(30);
|
|
xField.setText(titre);
|
|
JPanel myPanel = new JPanel();
|
|
myPanel.add(new JLabel("Titre :"));
|
|
myPanel.add(Box.createHorizontalStrut(2)); // a spacer
|
|
myPanel.add(xField);
|
|
|
|
|
|
int result = JOptionPane.showConfirmDialog(null, myPanel, "Saisissez votre titre 2 ", JOptionPane.OK_CANCEL_OPTION);
|
|
if (result == JOptionPane.OK_OPTION) {
|
|
nod.titre2(xField.getText());
|
|
fenetres.create.getTextNodeSelect().refreshAffichage(nod);
|
|
}
|
|
//
|
|
//
|
|
// String a = JOptionPane.showInputDialog(null,"Quel est le titre?",titre);
|
|
// nod.titre2(a);
|
|
// fenetres.create.getTextNodeSelect().refreshAffichage(nod);
|
|
}
|
|
|
|
}
|