use of java.awt.Dimension in project ACS by ACS-Community.
the class XmlComponentGui method wrapWithFrame.
private JFrame wrapWithFrame(JPanel jpanel) {
JFrame jframe;
jframe = new JFrame("XmlComponent's GUI");
jframe.getContentPane().add(jpanel);
// termination behav.
jframe.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
// position the frame in the middle of the screen
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int width = (int) screenSize.getWidth();
int height = (int) screenSize.getHeight();
width = (width >= 600 ? 600 : width);
height = (height >= 400 ? 400 : height);
jframe.setSize(width, height);
jframe.setLocation((int) (screenSize.getWidth() - width) / 2, (int) (screenSize.getHeight() - height) / 2);
return jframe;
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class JDynAct method buildWindow.
/** Build the GUI
*
*/
private void buildWindow() {
Container rootCnt = getContentPane();
rootCnt.setLayout(new BorderLayout());
// The container with labels and combo boxes
Container firstCnt = new Container();
firstCnt.setLayout(new GridLayout(4, 2));
firstCnt.add(new JLabel("Name"));
nameCB = new JComboBox();
nameCB.setEditable(true);
nameCB.addItem("*");
nameCB.addItem("PIPPO");
nameCB.addItem("PLUTO");
firstCnt.add(nameCB);
firstCnt.add(new JLabel("IDL interface"));
idlCB = new JComboBox();
idlCB.addItem("*");
idlCB.addItem("IDL:alma/acsexmplLamp/Lamp:1.0");
idlCB.addItem("IDL:alma/MOUNT_ACS/Mount:1.0");
idlCB.addItem("IDL:alma/demo/HelloDemo:1.0");
idlCB.setEditable(true);
firstCnt.add(idlCB);
firstCnt.add(new JLabel("Implementation"));
implCB = new JComboBox();
implCB.addItem("*");
implCB.addItem("acsexmplLampImpl");
implCB.addItem("acsexmplMountImpl");
implCB.addItem("alma.demo.HelloDemoImpl.HelloDemoHelper");
implCB.addItem("demoImpl.HelloDemo");
implCB.addItem("acsexmplHelloWorldClient");
implCB.setEditable(true);
firstCnt.add(implCB);
firstCnt.add(new JLabel("Container"));
containerCB = new JComboBox();
containerCB.addItem("*");
containerCB.addItem("bilboContainer");
containerCB.addItem("frodoContainer");
containerCB.addItem("aragornContainer");
containerCB.setEditable(true);
firstCnt.add(containerCB);
// The container with the activate button
Container secondCnt = new Container();
secondCnt.setLayout(new FlowLayout());
JButton activateB = new JButton("Activate");
activateB.addActionListener(this);
secondCnt.add(activateB, "Center");
// The container with activated container
MyTableModel tableModel = new MyTableModel();
activatedT = new JTable(tableModel);
activatedT.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel rowSM = activatedT.getSelectionModel();
JScrollPane scrollP = new JScrollPane(activatedT);
activatedT.setPreferredScrollableViewportSize(new Dimension(400, 90));
MyCellRendererr cellR = new MyCellRendererr();
TableColumnModel tcm = activatedT.getColumnModel();
TableColumn tc = tcm.getColumn(2);
tc.setCellRenderer(cellR);
MyCellEditor cellE = new MyCellEditor(this);
tc.setCellEditor(cellE);
Container thirdCnt = new Container();
thirdCnt.setLayout(new FlowLayout());
thirdCnt.add(scrollP, "North");
// Add the container to the main container
rootCnt.add(firstCnt, "North");
rootCnt.add(secondCnt, "Center");
rootCnt.add(thirdCnt, "South");
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class ScriptFilter method getFilterComponentTextField.
/**
* This method initializes filterComponentTextField
* @return javax.swing.JTextField
*/
private JTextField getFilterComponentTextField() {
if (filterComponentTextField == null) {
Dimension d = new Dimension(100, 19);
filterComponentTextField = new JTextField();
filterComponentTextField.setPreferredSize(d);
filterComponentTextField.setToolTipText("Write a word to find a particular component.");
//filterComponentTextField.setSize(d);
filterComponentTextField.setMinimumSize(d);
filterComponentTextField.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
filterComponentTextField.setHorizontalAlignment(JTextField.LEFT);
filterComponentTextField.getDocument().addDocumentListener(new DocumentListener() {
public void applyFilter() {
int total = compList.length;
String text = filterComponentTextField.getText();
if (!filterComponentTextField.getText().isEmpty()) {
ComponentComboBox.removeAllItems();
for (int i = 0; i < total; i++) {
if (compList[i].contains(text)) {
ComponentComboBox.addItem(compList[i]);
}
}
ComponentComboBox.hidePopup();
ComponentComboBox.showPopup();
} else {
ComponentComboBox.hidePopup();
ComponentComboBox.removeAllItems();
for (int j = 0; j < total; j++) {
ComponentComboBox.addItem(compList[j]);
}
}
if (ComponentComboBox.getItemCount() == 0) {
PropertyComboBox.removeAllItems();
}
}
public void changedUpdate(DocumentEvent e) {
}
public void insertUpdate(DocumentEvent e) {
applyFilter();
}
public void removeUpdate(DocumentEvent e) {
applyFilter();
}
});
}
return filterComponentTextField;
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class ScriptFilter method getPropertyComboBox.
/**
* This method initializes PropertyComboBox
* @return javax.swing.JComboBox
*/
private JComboBox getPropertyComboBox() {
if (PropertyComboBox == null) {
PropertyComboBox = new JComboBox();
PropertyComboBox.setPreferredSize(new Dimension(320, 24));
//PropertyComboBox.setSize(PropertyComboBox.getPreferredSize());
}
return PropertyComboBox;
}
use of java.awt.Dimension in project ACS by ACS-Community.
the class ScriptFilter method getFilterPropertyTextField.
/**
* This method initializes filterPropertyTextField
* @return javax.swing.JTextField
*/
private JTextField getFilterPropertyTextField() {
if (filterPropertyTextField == null) {
Dimension d = new Dimension(100, 19);
filterPropertyTextField = new JTextField();
filterPropertyTextField.setPreferredSize(d);
filterPropertyTextField.setToolTipText("Write a word to find a particular property.");
//filterPropertyTextField.setSize(d);
filterPropertyTextField.setMinimumSize(d);
filterPropertyTextField.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
filterPropertyTextField.setHorizontalAlignment(JTextField.LEFT);
filterPropertyTextField.getDocument().addDocumentListener(new DocumentListener() {
public void applyFilter() {
String item = (String) ComponentComboBox.getSelectedItem();
int i = -1;
for (int j = 0; j < compList.length; j++) {
if (compList[j].compareTo(item) == 0) {
i = j;
break;
}
}
if (i == -1) {
PropertyComboBox.removeAll();
return;
}
int total = propList.get(i).size();
String text = filterPropertyTextField.getText();
PropertyComboBox.removeAllItems();
for (int j = 0; j < total; j++) {
PropertyComboBox.addItem(propList.get(i).get(j).toString());
}
PropertyComboBox.showPopup();
if (!filterPropertyTextField.getText().isEmpty()) {
PropertyComboBox.removeAllItems();
for (int j = 0; j < total; j++) {
if (propList.get(i).get(j).toString().contains(text)) {
PropertyComboBox.addItem(propList.get(i).get(j).toString());
}
}
} else {
PropertyComboBox.hidePopup();
}
}
public void changedUpdate(DocumentEvent e) {
}
public void insertUpdate(DocumentEvent e) {
applyFilter();
}
public void removeUpdate(DocumentEvent e) {
applyFilter();
}
});
}
return filterPropertyTextField;
}
Aggregations