本文整理汇总了Java中javax.swing.border.LineBorder类的典型用法代码示例。如果您正苦于以下问题:Java LineBorder类的具体用法?Java LineBorder怎么用?Java LineBorder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LineBorder类属于javax.swing.border包,在下文中一共展示了LineBorder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CollisionBoxPanel
import javax.swing.border.LineBorder; //导入依赖的package包/类
public CollisionBoxPanel() {
TitledBorder border = new TitledBorder(new LineBorder(new Color(128, 128, 128)), Resources.get("panel_collisionBox"), TitledBorder.LEADING, TitledBorder.TOP, null, null);
border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD));
setBorder(border);
chckbxIsObstacle = new JCheckBox(Resources.get("panel_isObstacle"));
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(chckbxIsObstacle, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
.addContainerGap(322, Short.MAX_VALUE)));
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addComponent(chckbxIsObstacle, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
.addContainerGap(258, Short.MAX_VALUE)));
setLayout(groupLayout);
this.setupChangedListeners();
}
示例2: FoldingToolTip
import javax.swing.border.LineBorder; //导入依赖的package包/类
/** Creates a new instance of FoldingToolTip */
public FoldingToolTip(View view, EditorUI editorUI) {
this.view = view;
this.editorUI = editorUI;
FontColorSettings fcs = MimeLookup.getLookup(
org.netbeans.lib.editor.util.swing.DocumentUtilities.getMimeType(
editorUI.getComponent())).lookup(FontColorSettings.class);
AttributeSet attribs = fcs.getFontColors(FontColorNames.DEFAULT_COLORING);
Color foreColor = (Color) attribs.getAttribute(StyleConstants.Foreground);
if (foreColor == null) {
foreColor = Color.black;
}
setBorder(new LineBorder(foreColor));
setOpaque(true);
}
示例3: getTableCellEditorComponent
import javax.swing.border.LineBorder; //导入依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected,
int row, int column) {
JComponent c = (JComponent)super.getTableCellEditorComponent(table, value, isSelected, row, column);
cell.setText((String) value);
this.orig = cell.getTextField().getText();
this.action = ((ActionHolder) table.getValueAt(row, 0)).getAction();
final JTextField textField = cell.getTextField();
textField.addActionListener(delegate);
textField.setBorder(new LineBorder(Color.BLACK));
if(!Arrays.asList(textField.getKeyListeners()).contains(escapeAdapter)) {
textField.addKeyListener(escapeAdapter);
}
// allow the UI delegate to replace the background with more sensible color
cell.setBgColor(c.getBackground());
cell.setFgCOlor(c.getForeground(), false);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
textField.requestFocus();
}
});
return cell;
}
示例4: setHighlighted
import javax.swing.border.LineBorder; //导入依赖的package包/类
void setHighlighted() {
if (!isMac) {
setBorder(new CompoundBorder(
new CompoundBorder(
new LineBorder(getTabPanelBackground()),
new LineBorder(highlightedB)
),
new EmptyBorder(0, 2, 0, 2)
));
setBackground(highlighted);
}
if (!category.isHighlited()) {
if (categoryModel.getHighlitedCategoryID() != null) {
CategoryButton b = buttons.get(categoryModel.getHighlitedCategoryID());
if (b != null && !b.category.isCurrent()) {
b.setNormal();
}
}
categoryModel.setHighlited(category,true);
}
}
示例5: prepareRenderer
import javax.swing.border.LineBorder; //导入依赖的package包/类
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component c = super.prepareRenderer(renderer, row, column);
if (getModel().hasUpdates(
convertRowIndexToModel(row),
convertColumnIndexToModel(column))) {
Color color = isCellSelected(row, column) ? selectedForeground : unselectedForeground;
if (c instanceof JCheckBox) {
checkboxReplacement.removeAll();
checkboxReplacement.setBorder(new LineBorder(color, borderThickness));
checkboxReplacement.add(c);
return checkboxReplacement;
} else {
c.setForeground(color);
return c;
}
}
return c;
}
示例6: destacarCampo
import javax.swing.border.LineBorder; //导入依赖的package包/类
private void destacarCampo(JFormattedTextField field) {
final int timerDelay = 500;
final int totalTime = 2000;
final int totalCount = totalTime / timerDelay;
Timer timer = new Timer(timerDelay, new ActionListener(){
int count = 0;
public void actionPerformed(ActionEvent evt) {
if (count % 2 == 0) {
field.setBorder(new LineBorder(Color.RED, 2, true));
field.requestFocus();
} else {
field.setBorder(new LineBorder(Color.GRAY, 1, false));
if (count >= totalCount) {
((Timer)evt.getSource()).stop();
}
}
count++;
}
});
timer.start();
}
示例7: ButtonCellRenderer
import javax.swing.border.LineBorder; //导入依赖的package包/类
/**
* Create the ButtonCellRenderer to be used as a renderer and editor. The
* renderer and editor will automatically be installed on the TableColumn of
* the specified column.
*
* @param table the table containing the button renderer/editor
* @param action the Action to be invoked when the button is invoked
* @param column the column to which the button renderer/editor is added
*/
public ButtonCellRenderer(JTable table, Action action, int column) {
this.table = table;
this.action = action;
renderButton = new JButton();
editButton = new JButton();
editButton.setFocusPainted(false);
editButton.addActionListener(this);
originalBorder = editButton.getBorder();
setFocusBorder(new LineBorder(Color.BLUE));
TableColumnModel columnModel = table.getColumnModel();
columnModel.getColumn(column).setCellRenderer(this);
columnModel.getColumn(column).setCellEditor(this);
table.addMouseListener(this);
}
示例8: OptionTextArea
import javax.swing.border.LineBorder; //导入依赖的package包/类
/**
* Constructs a new OptionTextArea with the text given.
*
* @param content
* The content written onto this area.
* @param manager
* The style manager used to handle colors.
*/
public OptionTextArea(final String content, final StyleManager manager) {
super(content);
// Add a little margin to the left, so the content of this text area
// doesn't cling to its edge.
this.setBorder(
BorderFactory.createCompoundBorder(LineBorder.createBlackLineBorder(), new EmptyBorder(0, 2, 0, 0)));
// This isn't a good solution. We just set our preferred width to 1 so
// the layout manager managing this component doesn't try to resize it
// beyond its own "fill" parameter, since 1 < fill. This maintains a
// stable size of this text area and won't deform the layout if the
// input query is too long.
this.setPreferredSize(new Dimension(1, (int) (Window.TEXT_AREA_FONT.getSize() * 1.3f)));
this.setFont(Window.TEXT_AREA_FONT);
this.mManager = manager;
this.setBackground(manager.getTextAreaColor());
this.setForeground(manager.getDefaultFontColor());
}
示例9: sendCrashReport
import javax.swing.border.LineBorder; //导入依赖的package包/类
/**
* This method sends the crash report then displays alloy.mit.edu's reply in
* a text window.
*/
private static void sendCrashReport(Thread thread, Throwable ex, String email, String problem) {
try {
final String report = prepareCrashReport(thread, ex, email, problem);
final String alt = "Sorry. An error has occurred in posting the bug report.\n"
+ "Please email this report to [email protected] directly.\n\n" + dump(ex);
final JTextArea status = OurUtil.textarea("Sending the bug report... please wait...", 10, 40, false, true,
new LineBorder(Color.GRAY));
new Thread(new Runnable() {
public void run() {
final String output = readAll(ALLOY_URL, report, alt);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
status.setText(output);
status.setCaretPosition(0);
}
});
}
}).start();
OurDialog.showmsg("Sending the bug report... please wait...", status);
} finally {
System.exit(1);
}
}
示例10: stopCellEditing
import javax.swing.border.LineBorder; //导入依赖的package包/类
@Override
public boolean stopCellEditing() {
final String s = (String) super.getCellEditorValue();
if ("".equals(s)) {
return super.stopCellEditing();
}
try {
value = format.parse(s);
if (value instanceof Long)
value = new Double(value.toString());
else if (value instanceof Integer)
value = new Double(value.toString());
} catch (final Exception e) {
((JComponent) getComponent()).setBorder(new LineBorder(
Color.red));
return false;
}
return super.stopCellEditing();
}
示例11: getTableCellEditorComponent
import javax.swing.border.LineBorder; //导入依赖的package包/类
@Override
public Component getTableCellEditorComponent(final JTable table,
Object value, final boolean isSelected, final int row,
final int column) {
this.value = null;
((JComponent) getComponent())
.setBorder(new LineBorder(Color.black));
if (value != null) {
try {
value = format.format(value);
} catch (Exception e) {
e.printStackTrace();
}
}
Component tableCellEditorComponent = super.getTableCellEditorComponent(table, value, isSelected, row, column);
if (tableCellEditorComponent instanceof JTextField) {
((JTextField) tableCellEditorComponent).selectAll();
}
return tableCellEditorComponent;
}
示例12: stopCellEditing
import javax.swing.border.LineBorder; //导入依赖的package包/类
@Override
public boolean stopCellEditing() {
final String s = (String) super.getCellEditorValue();
if ("".equals(s)) {
return super.stopCellEditing();
}
try {
value = new Long(s);
} catch (final Exception e) {
((JComponent) getComponent()).setBorder(new LineBorder(
Color.red));
return false;
}
return super.stopCellEditing();
}
示例13: stopCellEditing
import javax.swing.border.LineBorder; //导入依赖的package包/类
@Override
public boolean stopCellEditing() {
final String s = (String) super.getCellEditorValue();
if ("".equals(s)) {
return super.stopCellEditing();
}
try {
value = format.parse(s);
if (value instanceof Long)
value = new Double(value.toString());
else if (value instanceof Integer)
value = new Double(value.toString());
} catch (final Exception e) {
((JComponent) getComponent()).setBorder(new LineBorder(Color.red));
return false;
}
return super.stopCellEditing();
}
示例14: RelationTypeTestsPanel
import javax.swing.border.LineBorder; //导入依赖的package包/类
public RelationTypeTestsPanel() {
setBorder(new TitledBorder(new LineBorder(new Color(184, 207, 229)), "Relation tests", TitledBorder.LEADING,
TitledBorder.TOP, null, new Color(51, 51, 51)));
setLayout(new BorderLayout());
tests = new WebList();
MButtonPanel buttonsPanel = new MButtonPanel(moveUpButton, moveDownButton,
addButton, editButton, removeButton)
.withVerticalLayout()
.withAllButtonsEnabled(true)
.withMargin(10);
add(new WebScrollPane(tests), BorderLayout.CENTER);
add(buttonsPanel, BorderLayout.EAST);
}
示例15: init
import javax.swing.border.LineBorder; //导入依赖的package包/类
private void init() {
setBorder(new TitledBorder(new LineBorder(new Color(184, 207, 229)), "Relation properties", TitledBorder.LEADING,
TitledBorder.TOP, null, new Color(51, 51, 51)));
WebScrollPane descriptionScrollWrapper = new WebScrollPane(relationDescription);
setLayout(new RiverLayout());
colorChooser.setPipetteEnabled(false);
colorChooser.setFieldType(ColorChooserFieldType.hex);
add(LINE_BREAK + " " + RIGHT, nameLabel);
add(TAB_FILL, relationName);
add(LINE_BREAK, displayLabel);
add(TAB_FILL, relationDisplay);
add(LINE_BREAK, shortcutLabel);
add(TAB_FILL, relationShortcut);
add(LINE_BREAK, descriptionLabel);
add(TAB_FILL, descriptionScrollWrapper);
add(LINE_BREAK, lexiconLabel);
add(TAB_FILL, lexicon);
add(RIGHT, lexiconBtn);
add(LINE_BREAK, multilingualLabel);
add(TAB_FILL, multilingual);
add(LINE_BREAK, posLabel);
add(TAB_FILL, allowedPartsOfSpeech);
add(RIGHT, showAllowedPartsOfSpeechBtn);
add(LINE_BREAK, reverseLabel);
add(TAB_FILL, reverseRelation);
add(RIGHT, reverseRelationBtn);
add(LINE_BREAK, colorLabel);
add(TAB_FILL, colorChooser);
add(LINE_BREAK, directionLabel);
add(TAB_FILL, relationDirection);
add(RiverLayout.LINE_BREAK + " " + RiverLayout.CENTER, btnSave);
}