use of java.awt.Container in project yyl_example by Relucent.
the class SocketHttp1_0Main method main.
/**
* 主函数
* @param args
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
Container container = frame.getContentPane();
container.add(new Content1().getContainer());
frame.setBounds(100, 100, 500, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("NIO-TEST");
frame.setResizable(false);
frame.setVisible(true);
}
use of java.awt.Container 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.Container in project ACS by ACS-Community.
the class WindowUtils method frameResidesInDesktop.
/**
* Utility method: makes the given mode either reside in the desktop or display a separate window.
* @param mode the mode to make reside in the desktop
* @param frameType indicates the type of frame, MDI or SDI
*/
public static void frameResidesInDesktop(Mode mode, int frameType) {
Assertion.assertTrue(mode != null, "mode != null");
try {
ClassLoader classLoader = Mode.class.getClassLoader();
Class modeImpl = Class.forName("org.netbeans.core.windows.ModeImpl", true, classLoader);
Method getCurrentConstraintsMethod = modeImpl.getMethod("getCurrentConstraints", null);
Object currentConstraints = getCurrentConstraintsMethod.invoke(mode, null);
Method setFrameTypeMethod = modeImpl.getMethod("setFrameType", new Class[] { String.class });
Method setVisibleMethod = modeImpl.getMethod("setVisible", new Class[] { boolean.class });
Method isVisibleMethod = modeImpl.getMethod("isVisible", null);
boolean wasVisible = ((Boolean) isVisibleMethod.invoke(mode, null)).booleanValue();
if (frameType == DESKTOP_FRAME)
currentConstraints = CONSTRAINT_WEST;
Class windowUtils = Class.forName("org.netbeans.core.windows.util.WindowUtils", true, classLoader);
Method findConstrainedModeMethod = windowUtils.getMethod("findConstrainedMode", new Class[] { Workspace.class, Object.class });
Object constrainedMode = findConstrainedModeMethod.invoke(null, new Object[] { mode.getWorkspace(), currentConstraints });
String frameTypeName = possibleFrameTypes[frameType];
if (constrainedMode != null && frameType == DESKTOP_FRAME) {
frameType = INTERNAL_FRAME;
frameTypeName = possibleFrameTypes[frameType];
currentConstraints = null;
}
Class windowTypeMgr = Class.forName("org.netbeans.core.windows.frames.WindowTypesManager", true, classLoader);
Field frameFieldMode = windowTypeMgr.getField(frameTypeName);
Method changeModeConstraintsMethod = windowUtils.getMethod("changeModeConstraints", new Class[] { modeImpl, Object.class });
changeModeConstraintsMethod.invoke(null, new Object[] { mode, currentConstraints });
setFrameTypeMethod.invoke(mode, new Object[] { frameFieldMode.get(windowTypeMgr) });
if (wasVisible) {
setVisibleMethod.invoke(mode, new Object[] { Boolean.TRUE });
Class mainWindow = Class.forName("org.netbeans.core.windows.MainWindow", true, classLoader);
Method getDefaultMethod = mainWindow.getMethod("getDefault", null);
Method getContentPaneMethod = mainWindow.getMethod("getContentPane", null);
Container cp = (Container) getContentPaneMethod.invoke(getDefaultMethod.invoke(null, null), null);
cp.validate();
}
} catch (Exception e) {
GPManager.notify(GPManager.EXCEPTION, e);
}
}
use of java.awt.Container in project EnrichmentMapApp by BaderLab.
the class AddRanksDialog method createContents.
private void createContents() {
JPanel textFieldPanel = createTextFieldPanel();
JPanel buttonPanel = createButtonPanel();
Container contentPane = this.getContentPane();
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup().addComponent(textFieldPanel).addComponent(buttonPanel));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(textFieldPanel).addGap(0, 0, Short.MAX_VALUE).addComponent(buttonPanel));
}
use of java.awt.Container in project ats-framework by Axway.
the class SwingElementLocator method getContainerFixture.
/**
* Change container by specified name or title.
* For internal use
* @param driver
* @param containerProperties property with name inside
* @return the {@link ContainerFinxture}
*/
public static ContainerFixture<?> getContainerFixture(SwingDriverInternal driver, UiElementProperties containerProperties) {
String containerName = containerProperties.getProperty("name");
final String containerTitle = containerProperties.getProperty("title");
if (StringUtils.isNullOrEmpty(containerName) && StringUtils.isNullOrEmpty(containerTitle)) {
throw new IllegalArgumentException("Illegal name/title (empty/null string) passed to search for container");
}
ContainerFixture<?> containerFixture = driver.getActiveContainerFixture();
ContainerFixture<?> windowsFixture = driver.getWindowFixture();
Robot robot = null;
if (containerFixture != null) {
// use the current robot instance
robot = containerFixture.robot;
} else {
robot = BasicRobot.robotWithCurrentAwtHierarchy();
}
if (!StringUtils.isNullOrEmpty(containerName)) {
try {
Container cont = BasicComponentFinder.finderWithCurrentAwtHierarchy().findByName(windowsFixture.component(), containerName, Container.class);
return new ContainerFixture<Container>(robot, cont) {
};
} catch (WaitTimedOutError wtoe) {
throw new ElementNotFoundException("Unable to find container with name '" + containerName + "' under current window/dialog. If needed change current window first with swingEngineInstance.setActiveWindow()");
}
} else {
try {
Container cont = BasicComponentFinder.finderWithCurrentAwtHierarchy().find(windowsFixture.component(), new GenericTypeMatcher<Container>(Container.class, true) {
@Override
protected boolean isMatching(Container component) {
if (component instanceof Dialog) {
return ((Dialog) component).getTitle().equals(containerTitle);
} else if (component instanceof Frame) {
return ((Frame) component).getTitle().equals(containerTitle);
} else if (component instanceof JInternalFrame) {
return ((JInternalFrame) component).getTitle().equals(containerTitle);
}
return false;
}
});
return new ContainerFixture<Container>(robot, cont) {
};
} catch (WaitTimedOutError wtoe) {
throw new ElementNotFoundException("Unable to find container with title '" + containerName + "' under current window/dialog. If needed change current window first with swingEngineInstance.setActiveWindow()");
}
}
}
Aggregations