Java Code Examples for org.jdesktop.swingx.JXTextField#setPromptForeground()

The following examples show how to use org.jdesktop.swingx.JXTextField#setPromptForeground() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseOperationsPanel.java    From importer-exporter with Apache License 2.0 5 votes vote down vote up
private void init() {
	setLayout(new GridBagLayout());

	workspace = new JXTextField();
	workspace.setPromptForeground(Color.LIGHT_GRAY);
	workspace.setFocusBehavior(FocusBehavior.SHOW_PROMPT);
	datePicker = new DatePicker();
	workspaceLabel = new JLabel();
	timestampLabel = new JLabel();

	add(workspaceLabel, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.BOTH,0,0,5,5));
	add(workspace, GuiUtil.setConstraints(1,0,1.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
	add(timestampLabel, GuiUtil.setConstraints(2,0,0.0,0.0,GridBagConstraints.NONE,0,10,5,5));
	add(datePicker, GuiUtil.setConstraints(3,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,0));

	operationsTab = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
	add(operationsTab, GuiUtil.setConstraints(0,2,4,1,1.0,1.0,GridBagConstraints.BOTH,5,0,0,0));

	operations = new DatabaseOperationView[]{
			new ReportOperation(this),
			new BoundingBoxOperation(this, config),
			new IndexOperation(this, config),
			new SrsOperation(this, config),
			new ADEInfoOperation(this)
	};

	for (int i = 0; i < operations.length; ++i)
		operationsTab.insertTab(null, operations[i].getIcon(), null, operations[i].getToolTip(), i);

	operationsTab.addChangeListener(e -> {
		int index = operationsTab.getSelectedIndex();
		for (int i = 0; i < operationsTab.getTabCount(); i++)
			operationsTab.setComponentAt(i, index == i ? operations[index].getViewComponent() : null);
	});

	PopupMenuDecorator.getInstance().decorate(workspace, datePicker.getEditor());
}
 
Example 2
Source File: ExportPanel.java    From importer-exporter with Apache License 2.0 4 votes vote down vote up
private void initGui(JAXBContext projectContext) {
	browseText = new JTextField();
	browseButton = new JButton();
	workspaceText = new JXTextField();
	workspaceText.setPromptForeground(Color.LIGHT_GRAY);
	workspaceText.setFocusBehavior(FocusBehavior.SHOW_PROMPT);
	datePicker = new DatePicker();
	filterPanel = new FilterPanel(viewController, projectContext, config);
	exportButton = new JButton();
	switchFilterModeButton = new JButton();

	workspaceText.setEnabled(true);
	datePicker.setEnabled(true);
	browseButton.addActionListener(e -> saveFile(Language.I18N.getString("main.tabbedPane.export")));

	PopupMenuDecorator.getInstance().decorate(workspaceText, datePicker.getEditor(), browseText);

	exportButton.addActionListener(e -> new SwingWorker<Void, Void>() {
		protected Void doInBackground() {
			doExport();
			return null;
		}
	}.execute());

	setLayout(new GridBagLayout());

	JPanel filePanel = new JPanel();
	add(filePanel, GuiUtil.setConstraints(0,0,1.0,0.0,GridBagConstraints.BOTH,10,5,5,5));
	filePanel.setLayout(new GridBagLayout());
	filePanel.add(browseText, GuiUtil.setConstraints(0,0,1.0,1.0,GridBagConstraints.BOTH,5,5,5,5));
	filePanel.add(browseButton, GuiUtil.setConstraints(1,0,0.0,0.0,GridBagConstraints.NONE,5,5,5,5));

	JPanel view = new JPanel();
	view.setLayout(new GridBagLayout());
	JScrollPane scrollPane = new JScrollPane(view);
	scrollPane.setBorder(BorderFactory.createEmptyBorder());
	scrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
	add(scrollPane, GuiUtil.setConstraints(0,1,1.0,1.0,GridBagConstraints.BOTH,0,0,0,0));

	operations = new JPanel();
	view.add(operations, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
	operations.setBorder(BorderFactory.createTitledBorder(""));
	operations.setLayout(new GridBagLayout());
	workspaceLabel = new JLabel();
	timestampLabel = new JLabel();
	srsComboBoxLabel = new JLabel();
	srsComboBox = SrsComboBoxFactory.getInstance(config).createSrsComboBox(true);
	srsComboBox.setShowOnlySameDimension(true);
	srsComboBox.setPreferredSize(new Dimension(50, srsComboBox.getPreferredSize().height));

	operations.add(workspaceLabel, GuiUtil.setConstraints(0,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
	operations.add(workspaceText, GuiUtil.setConstraints(1,0,1.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
	operations.add(timestampLabel, GuiUtil.setConstraints(2,0,0.0,0.0,GridBagConstraints.NONE,0,10,5,5));
	operations.add(datePicker, GuiUtil.setConstraints(3,0,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
	operations.add(srsComboBoxLabel, GuiUtil.setConstraints(0,1,0.0,0.0,GridBagConstraints.HORIZONTAL,0,5,5,5));
	operations.add(srsComboBox, GuiUtil.setConstraints(1,1,3,1,1.0,0.0,GridBagConstraints.BOTH,0,5,5,5));

	view.add(filterPanel, GuiUtil.setConstraints(0,3,1.0,1.0,GridBagConstraints.NORTH,GridBagConstraints.BOTH,0,5,0,5));

	JPanel buttons = new JPanel();
	buttons.setLayout(new GridBagLayout());
	add(buttons, GuiUtil.setConstraints(0,4,1.0,0.0,GridBagConstraints.BOTH,5,5,5,5));
	buttons.add(exportButton, GuiUtil.setConstraints(0,0,2,1,1.0,0.0,GridBagConstraints.NONE,5,5,5,5));
	buttons.add(switchFilterModeButton, GuiUtil.setConstraints(1,0,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.NONE,5,5,5,5));

	DropTarget dropTarget = new DropTarget(browseText, this);
	browseText.setDropTarget(dropTarget);
	setDropTarget(dropTarget);

	switchFilterModeButton.addActionListener(e -> switchFilterMode());
}