當前位置: 首頁>>代碼示例>>Java>>正文


Java LineBorder類代碼示例

本文整理匯總了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();
}
 
開發者ID:gurkenlabs,項目名稱:litiengine,代碼行數:24,代碼來源:CollisionBoxPanel.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:FoldingToolTip.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:ButtonCellEditor.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:OptionsPanel.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:DataViewTableUI.java

示例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();
}
 
開發者ID:tglima,項目名稱:CRS,代碼行數:24,代碼來源:ControllerPrincipal.java

示例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);
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:26,代碼來源:ButtonCellRenderer.java

示例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());
}
 
開發者ID:ZabuzaW,項目名稱:TreeFlood,代碼行數:30,代碼來源:OptionTextArea.java

示例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);
	}
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:28,代碼來源:MailBug.java

示例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();
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:21,代碼來源:DoubleAttributePlugin.java

示例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;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:21,代碼來源:DoubleAttributePlugin.java

示例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();
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:17,代碼來源:LongAttributePlugin.java

示例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();
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:20,代碼來源:DoubleCellEditor.java

示例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);
    }
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:19,代碼來源:RelationTypeTestsPanel.java

示例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);
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:37,代碼來源:RelationTypePropertiesPanel.java


注:本文中的javax.swing.border.LineBorder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。