javax.swing.border.TitledBorder Java Examples

The following examples show how to use javax.swing.border.TitledBorder. 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: Test7034614.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Graphics g = new BufferedImage(9, 9, 9).getGraphics();

    BrokenBorder broken = new BrokenBorder();
    TitledBorder titled = new TitledBorder(broken, broken.getClass().getName());

    Insets insets = (Insets) broken.getBorderInsets(broken).clone();
    titled.getBorderInsets(broken);
    broken.validate(insets);
    for (int i = 0; i < 10; i++) {
        titled.paintBorder(broken, g, 0, 0, i, i);
        broken.validate(insets);
        titled.getBaseline(broken, i, i);
        broken.validate(insets);
    }
}
 
Example #2
Source File: XMBeanInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public void addMBeanNotificationInfo(MBeanNotificationInfo mbni) {
    emptyInfoTable();
    emptyDescTable();
    ((TitledBorder) infoBorderPanel.getBorder()).setTitle(
            Messages.MBEAN_NOTIFICATION_INFO);
    String text = Messages.NOTIFICATION + ":";
    DefaultTableModel tableModel = (DefaultTableModel) infoTable.getModel();
    Object rowData[] = new Object[2];
    rowData[0] = new TableRowDivider(text);
    rowData[1] = new TableRowDivider("");
    tableModel.addRow(rowData);
    rowData[0] = Messages.NAME;
    rowData[1] = mbni.getName();
    tableModel.addRow(rowData);
    rowData[0] = Messages.DESCRIPTION;
    rowData[1] = mbni.getDescription();
    tableModel.addRow(rowData);
    rowData[0] = Messages.NOTIF_TYPES;
    rowData[1] = Arrays.toString(mbni.getNotifTypes());
    tableModel.addRow(rowData);
    addDescriptor(mbni.getDescriptor(), text);
    tableModel.newDataAvailable(new TableModelEvent(tableModel));
}
 
Example #3
Source File: PruebaCorrelacionIdiomas.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void anhadeTextAreaParaTextoAnalizado(Container contenedor) {
	areaDeTextoAAnalizar = new JTextArea();
       areaDeTextoAAnalizar.setLineWrap(true);
       areaDeTextoAAnalizar.setWrapStyleWord(true);
       areaDeTextoAAnalizar.setColumns(40);
       areaDeTextoAAnalizar.invalidate();

       JScrollPane scroll = new JScrollPane(areaDeTextoAAnalizar);
       scroll.setBorder(new TitledBorder("Escribe o copia aqu� un texto"));

       GridBagConstraints constraints = new GridBagConstraints();
       constraints.gridx = 0;
       constraints.gridy = 1;
       constraints.gridwidth = 4;
       constraints.gridheight = 1;
       constraints.weightx = 1.0;
       constraints.weighty = 1.0;
       constraints.fill = GridBagConstraints.BOTH;
       contenedor.add(scroll, constraints);
}
 
Example #4
Source File: MainWindow.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * @return Message components.
 */
private Component createMessageComponents() {
  JPanel panel = new JPanel(new GridLayout(1, 0));
  panel.setBorder(BorderFactory.createTitledBorder(
      BorderFactory.createEtchedBorder(
          Version.HIGHLIGHT ? Color.RED : null,
          Version.HIGHLIGHT ? Color.RED : null),
      GT._T("Message"),
      TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION));
  if (Version.HIGHLIGHT) {
    panel.setBackground(Color.RED);
  }
  HTMLPane textMessage = HTMLPane.createHTMLPane(Version.MESSAGE);
  JScrollPane scrollMessage = new JScrollPane(textMessage);
  scrollMessage.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  panel.add(scrollMessage);
  return panel;
}
 
Example #5
Source File: CDialogUpdater.java    From binnavi with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the condition configuration panel.
 *
 * @param node The actively selected node.
 */
private void updateDefineConditionPanel(final JCriteriumTreeNode node) {
  final Component component = node.getCriterium().getCriteriumPanel();

  m_defineConditionPanel.removeAll();
  m_defineConditionPanel.setBorder(null);

  if (component == null) {
    final JPanel defaultPanel = new JPanel(new BorderLayout());
    defaultPanel.setBorder(new TitledBorder("Define Condition"));

    m_defineConditionPanel.add(defaultPanel, BorderLayout.CENTER);
  } else {
    m_defineConditionPanel.add(component);
  }

  m_defineConditionPanel.updateUI();
}
 
Example #6
Source File: RESTView.java    From rest-client with Apache License 2.0 6 votes vote down vote up
/**
* 
* @Title: init 
* @Description: Component Initialization 
* @param
* @return void 
* @throws
 */
private void init()
{
    this.setLayout(new BorderLayout(RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH));
    this.setBorder(BorderFactory.createEmptyBorder(RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH, RESTConst.BORDER_WIDTH));

    vReq = new ReqView();
    vRsp = new RspView();
    vHist = new HistView();

    tp = new JTabbedPane();
    tp.add(RESTConst.REQUEST, vReq);
    tp.add(RESTConst.RESPONSE, vRsp);
    tp.add(RESTConst.HIST, vHist);

    this.add(tp);

    this.setBorder(BorderFactory.createTitledBorder(null, RESTConst.REST_CLIENT, TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION));
}
 
Example #7
Source File: FeatureTypeParametersView.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public JPanel createPanel1()
{
   JPanel jpanel1 = new JPanel();
   TitledBorder titledborder1 = new TitledBorder(null,"FeatureType Parameters",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33));
   jpanel1.setBorder(titledborder1);
   FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:6.0CM:NONE,FILL:4DLU:NONE,FILL:DEFAULT:GROW(1.0)","CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _nameLabel.setName("nameLabel");
   _nameLabel.setText("name");
   jpanel1.add(_nameLabel,cc.xy(2,3));

   _nameTextField.setName("nameTextField");
   jpanel1.add(_nameTextField,cc.xy(4,3));

   addFillComponents(jpanel1,new int[]{ 1,2,3,4 },new int[]{ 1,2,3,4,5,6 });
   return jpanel1;
}
 
Example #8
Source File: TextAreaPage.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
private void create() {
  setLayout(new BorderLayout());

  JPanel middlePanel = new JPanel();
  middlePanel.setBorder(new TitledBorder(new EtchedBorder(), title));

  display = new JTextArea(10, 48);
  display.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, "\n");
  display.setEditable(false);
  display.setForeground(fontColor);

  JScrollPane scroll = new JBScrollPane(display);
  scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  middlePanel.add(scroll);

  add(middlePanel, BorderLayout.CENTER);

  JPanel progressPanel = new JPanel();
  progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.Y_AXIS));
}
 
Example #9
Source File: LasInfoView.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public JPanel createPanel3()
{
   JPanel jpanel1 = new JPanel();
   TitledBorder titledborder1 = new TitledBorder(null,"Header Information",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33));
   jpanel1.setBorder(titledborder1);
   FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0)","FILL:DEFAULT:GROW(1.0)");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _headerTable.setName("headerTable");
   JScrollPane jscrollpane1 = new JScrollPane();
   jscrollpane1.setViewportView(_headerTable);
   jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane1,cc.xy(1,1));

   addFillComponents(jpanel1,new int[0],new int[0]);
   return jpanel1;
}
 
Example #10
Source File: Test7034614.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    Graphics g = new BufferedImage(9, 9, 9).getGraphics();

    BrokenBorder broken = new BrokenBorder();
    TitledBorder titled = new TitledBorder(broken, broken.getClass().getName());

    Insets insets = (Insets) broken.getBorderInsets(broken).clone();
    titled.getBorderInsets(broken);
    broken.validate(insets);
    for (int i = 0; i < 10; i++) {
        titled.paintBorder(broken, g, 0, 0, i, i);
        broken.validate(insets);
        titled.getBaseline(broken, i, i);
        broken.validate(insets);
    }
}
 
Example #11
Source File: PointAndCurveBalloonPanel.java    From importer-exporter with Apache License 2.0 6 votes vote down vote up
@Override
	public void doTranslation() {
		((TitledBorder)pointContentSourcePanel.getBorder()).setTitle(Language.I18N.getString("pref.kmlexport.balloon.contentSourceForPoint.border"));	
		pointIncludeDescription.setText(Language.I18N.getString("pref.kmlexport.balloon.label.includeDescription"));
		pointGenAttribRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttrib"));
		pointFileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.file"));
		pointGenAttribAndFileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttribAndFile"));
		pointBrowseButton.setText(Language.I18N.getString("common.button.browse"));
//		pointContentInSeparateFile.setText(Language.I18N.getString("pref.kmlexport.balloon.label.contentInSeparateFile"));
//		pointWarningLabel.setText(Language.I18N.getString("pref.kmlexport.balloon.label.warningLabel"));

		((TitledBorder)curveContentSourcePanel.getBorder()).setTitle(Language.I18N.getString("pref.kmlexport.balloon.contentSourceForCurve.border"));	
		curveIncludeDescription.setText(Language.I18N.getString("pref.kmlexport.balloon.label.includeDescription"));
		curveGenAttribRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttrib"));
		curveFileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.file"));
		curveGenAttribAndFileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttribAndFile"));
		curveBrowseButton.setText(Language.I18N.getString("common.button.browse"));
//		curveContentInSeparateFile.setText(Language.I18N.getString("pref.kmlexport.balloon.label.contentInSeparateFile"));
//		curveWarningLabel.setText(Language.I18N.getString("pref.kmlexport.balloon.label.warningLabel"));

		warningLabel1.setText(Language.I18N.getString("pref.kmlexport.balloon.label.settingsApplyFrom1"));
		warningLabel2.setText(Language.I18N.getString("pref.kmlexport.balloon.label.settingsApplyFrom2"));
	}
 
Example #12
Source File: LasInfoView.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public JPanel createPanel4()
{
   JPanel jpanel1 = new JPanel();
   TitledBorder titledborder1 = new TitledBorder(null,"First Point Information",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33));
   jpanel1.setBorder(titledborder1);
   FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0)","FILL:DEFAULT:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _firstPointTable.setName("firstPointTable");
   JScrollPane jscrollpane1 = new JScrollPane();
   jscrollpane1.setViewportView(_firstPointTable);
   jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   jpanel1.add(jscrollpane1,cc.xy(1,1));

   addFillComponents(jpanel1,new int[0],new int[0]);
   return jpanel1;
}
 
Example #13
Source File: AppearancePanel.java    From importer-exporter with Apache License 2.0 6 votes vote down vote up
private void setEnabledTextureExport() {
	overwriteCheck.setEnabled(exportAll.isSelected());
	noTexturesCheck.setEnabled(exportAll.isSelected());
	generateUniqueCheck.setEnabled(exportAll.isSelected());

	((TitledBorder) pathBlock.getBorder()).setTitleColor(exportAll.isSelected() ?
			UIManager.getColor("TitledBorder.titleColor") :
			UIManager.getColor("Label.disabledForeground"));
	pathBlock.repaint();

	pathLabel.setEnabled(exportAll.isSelected());
	pathText.setEnabled(exportAll.isSelected());
	browseButton.setEnabled(exportAll.isSelected());
	useBuckets.setEnabled(exportAll.isSelected());
	noOfBuckets.setEnabled(exportAll.isSelected() && useBuckets.isSelected());
}
 
Example #14
Source File: YoloUI.java    From Java-Machine-Learning-for-Computer-Vision with MIT License 6 votes vote down vote up
private void yoloChooser() {
    JPanel panel = new JPanel(new GridLayout(0, 2));
    Border border = BorderFactory.createTitledBorder("Choose Yolo");
    ((TitledBorder) border).setTitleFont(FONT_ITALIC);
    panel.setBorder(border);
    ButtonGroup group = new ButtonGroup();
    yolo = new JRadioButton("Load Real Yolo");
    yolo.setFont(FONT);
    group.add(yolo);
    panel.add(yolo);
    JRadioButton tinyYolo = new JRadioButton("Tiny Yolo");
    tinyYolo.setSelected(true);
    panel.add(tinyYolo);
    group.add(tinyYolo);
    tinyYolo.setFont(FONT);
    mainPanel.add(panel);
}
 
Example #15
Source File: RepositoryScreenShots.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void addConflictTypeDescription(Point windowLocationOnScreen,
		ConflictInfoPanel conflictInfoPanel) {
	Point infoPanelLocation = conflictInfoPanel.getLocationOnScreen();
	TitledBorder border = (TitledBorder) conflictInfoPanel.getBorder();
	Dimension minimumSize = border.getMinimumSize(new JPanel());
	int width = minimumSize.width;
	int endTitleTextX = infoPanelLocation.x - windowLocationOnScreen.x + width;
	int arrowHeadX = endTitleTextX + 10;
	int arrowTailX = arrowHeadX + 50;
	int descriptionX = arrowTailX + 10;
	int endTitleTextY = infoPanelLocation.y - windowLocationOnScreen.y;
	int arrowTailY = endTitleTextY - 5;
	int arrowHeadY = endTitleTextY + 5;
	int descriptionY = endTitleTextY;
	mtfGenerator.drawArrow(Color.RED, 2, new Point(arrowTailX, arrowTailY),
		new Point(arrowHeadX, arrowHeadY), 8);
	mtfGenerator.drawText("Type of conflict to resolve.", Color.RED,
		new Point(descriptionX, descriptionY), DESCRIPTION_FONT_SIZE);
}
 
Example #16
Source File: AdvisorPanel.java    From shakey with Apache License 2.0 6 votes vote down vote up
GroupsPanel() {
	JScrollPane groupScroll = new JScrollPane( m_groupTable);
	groupScroll.setBorder( new TitledBorder( "Groups"));
	
	HtmlButton create = new HtmlButton( "Create Group") {
		@Override protected void actionPerformed() {
			onCreateGroup();
		}
	};

	HtmlButton update = new HtmlButton( "Update") {
		@Override protected void actionPerformed() {
			onTransmit();
		}
	};
	
	JPanel buts = new VerticalPanel();
	buts.add( create);
	buts.add( update);

	setLayout( new BorderLayout() );
	add( groupScroll);
	add( buts, BorderLayout.EAST);
}
 
Example #17
Source File: CAbstractOperatorPanel.java    From binnavi with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new panel object.
 */
public CAbstractOperatorPanel() {
  super(new BorderLayout());

  final JPanel mainPanel = new JPanel(new BorderLayout());
  mainPanel.setBorder(new TitledBorder(getBorderTitle()));

  final JPanel infoPanel = new JPanel(new BorderLayout());
  infoPanel.setBorder(new EmptyBorder(5, 5, 5, 5));

  m_infoField.setBackground(infoPanel.getBackground());
  m_infoField.setLineWrap(true);
  m_infoField.setWrapStyleWord(true);
  m_infoField.setEditable(false);

  infoPanel.add(m_infoField, BorderLayout.CENTER);

  mainPanel.add(infoPanel, BorderLayout.CENTER);

  add(mainPanel, BorderLayout.CENTER);
}
 
Example #18
Source File: MapcalcView.java    From hortonmachine with GNU General Public License v3.0 6 votes vote down vote up
public JPanel createPanel()
{
   JPanel jpanel1 = new JPanel();
   FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(0.6),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   jpanel1.add(createPanel1(),cc.xywh(2,2,9,1));
   jpanel1.add(createPanel2(),cc.xywh(2,4,9,3));
   jpanel1.add(createPanel3(),cc.xywh(2,14,18,1));
   jpanel1.add(createPanel4(),cc.xywh(13,2,7,5));
   jpanel1.add(createPanel5(),cc.xywh(13,12,7,1));
   _syntaxHelpTab.setName("syntaxHelpTab");
   TitledBorder titledborder1 = new TitledBorder(null,"Syntax Help",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33));
   _syntaxHelpTab.setBorder(titledborder1);
   jpanel1.add(_syntaxHelpTab,cc.xywh(2,8,9,5));

   _debugCheckbox.setActionCommand("Debug");
   _debugCheckbox.setName("debugCheckbox");
   _debugCheckbox.setText("Debug");
   jpanel1.add(_debugCheckbox,cc.xywh(13,8,7,1));

   jpanel1.add(createPanel6(),cc.xywh(13,10,7,1));
   addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 });
   return jpanel1;
}
 
Example #19
Source File: CProjectNodeComponent.java    From binnavi with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new component object.
 *
 * @param projectTree Project tree that is updated when certain events happen.
 * @param database Database the project belongs to.
 * @param project The project whose information is displayed in the component.
 * @param container View container of the project.
 */
public CProjectNodeComponent(final JTree projectTree, final IDatabase database,
    final INaviProject project, final IViewContainer container) {
  super(new BorderLayout());
  Preconditions.checkNotNull(projectTree, "IE01985: Project tree argument can not be null");
  m_project = Preconditions.checkNotNull(project, "IE01986: Project argument can't be null");
  m_database = Preconditions.checkNotNull(database, "IE01987: Database argument can't be null");
  final CDefaultFieldDescription<String> nameInfo =
      new CDefaultFieldDescription<String>(project.getConfiguration().getName(), new CNameHelp());
  final CDefaultFieldDescription<String> descriptionInfo = new CDefaultFieldDescription<String>(
      project.getConfiguration().getDescription(), new CDescriptionHelp());
  final CDefaultFieldDescription<Date> creationInfo = new CDefaultFieldDescription<Date>(
      project.getConfiguration().getCreationDate(), new CCreationDateHelp());
  final CDefaultFieldDescription<Date> modificationInfo = new CDefaultFieldDescription<Date>(
      project.getConfiguration().getModificationDate(), new CModificationDateHelp());
  m_stdEditPanel = new CStandardEditPanel("Project", nameInfo, descriptionInfo, creationInfo,
      modificationInfo);
  m_checkedListPanel = new JPanel(new BorderLayout());
  m_table = new CAddressSpacesTable(projectTree, database, m_project, container);
  m_titledBorder = new TitledBorder(getBorderText());
  createGui();
  m_database.getContent().getDebuggerTemplateManager().addListener(m_debuggerManagerListener);
  project.addListener(m_projectListener);
  m_checkedList.addListSelectionListener(m_updateListener);
  m_stdEditPanel.addInputListener(m_updateListener);
  updateSaveButton();
}
 
Example #20
Source File: WaterBodyBalloonPanel.java    From importer-exporter with Apache License 2.0 5 votes vote down vote up
@Override
public void doTranslation() {
	((TitledBorder)contentSourcePanel.getBorder()).setTitle(Language.I18N.getString("pref.kmlexport.balloon.contentSource.border"));	

	includeDescription.setText(Language.I18N.getString("pref.kmlexport.balloon.label.includeDescription"));
	genAttribRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttrib"));
	fileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.file"));
	genAttribAndFileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttribAndFile"));
	browseButton.setText(Language.I18N.getString("common.button.browse"));
	contentInSeparateFile.setText(Language.I18N.getString("pref.kmlexport.balloon.label.contentInSeparateFile"));
	warningLabel.setText(Language.I18N.getString("pref.kmlexport.balloon.label.warningLabel"));
}
 
Example #21
Source File: PreferencesDialog.java    From yawl with GNU Lesser General Public License v3.0 5 votes vote down vote up
private JPanel getBottomPanel() {
    _portPanel = new JPanel();
    _portPanel.setLayout(new BoxLayout(_portPanel, BoxLayout.LINE_AXIS));
    _portPanel.setBorder(new CompoundBorder(
            new TitledBorder("Tomcat Port"),
            new EmptyBorder(5, 5, 5, 5)));
    _portField = new JFormattedTextField(getPortValueFormatter());
    _portField.setPreferredSize(new Dimension(75, 25));
    _portField.setBorder(new EmptyBorder(0,5,0,0));
    _portPanel.add(new JLabel("Port: "));
    _portPanel.add(_portField);
    enablePanel(_portPanel, !TomcatUtil.isEngineRunning());
    return _portPanel;
}
 
Example #22
Source File: CommonTestsCfgOfCreate.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a border and a title around a given component.
 * If the component already has some border, it is overridden (not kept).
 *
 * @param  component  component the border and title should be added to
 * @param  insets  insets between the component and the titled border
 * @param  title  text of the title
 */
private static void addTitledBorder(JComponent component,
                                    Insets insets,
                                    String title) {
    Border insideBorder = BorderFactory.createEmptyBorder(
            insets.top, insets.left, insets.bottom, insets.right);
    Border outsideBorder = new TitledBorder(
            BorderFactory.createEtchedBorder(), title);
    component.setBorder(new CompoundBorder(outsideBorder, insideBorder));
}
 
Example #23
Source File: Test7149090.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    for (UIManager.LookAndFeelInfo lookAndFeel : UIManager.getInstalledLookAndFeels()) {
        for (Object[] defaultTitlePosition : DEFAULT_TITLE_POSITIONS) {
            if (defaultTitlePosition[0].equals(lookAndFeel.getName())) {
                UIManager.setLookAndFeel(lookAndFeel.getClassName());

                final int expectedPosition = (Integer) defaultTitlePosition[1];

                SwingUtilities.invokeAndWait(new Runnable() {
                    @Override
                    public void run() {
                        List<TitledBorder> borders = new ArrayList<>();

                        borders.add(BorderFactory.createTitledBorder(new EmptyBorder(0, 0, 0, 0), "Title"));

                        try {
                            Method getPositionMethod = TitledBorder.class.getDeclaredMethod("getPosition");

                            getPositionMethod.setAccessible(true);

                            for (TitledBorder border : borders) {
                                int position = (Integer) getPositionMethod.invoke(border);

                                if (position != expectedPosition) {
                                    throw new RuntimeException("Invalid title position");
                                }
                            }
                        } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
                            throw new RuntimeException(e);
                        }
                    }
                });

                System.out.println("Test passed for LookAndFeel " + lookAndFeel.getName());
            }
        }
    }
}
 
Example #24
Source File: ConverterFrame.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
public void setProgress(String text, int percent) {
    Border border = BorderFactory.createTitledBorder(new EmptyBorder(0, 0, 0, 0), "Time remaining: " + text, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Lucida Sans Unicode",Font.PLAIN,12), OFF_WHITE);
    progressBar.setVisible(true);
    progressBar.setBorder(border);
    progressBar.setValue(percent);
    repaint();
}
 
Example #25
Source File: FontSizer.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Increases a titled border's normal font size by the specified factor.
 *
 * @param b a titled border
 * @param factor the factor
 */
private static void setFontFactor(TitledBorder b, double factor) {
  // get resized border font
	Font font = b.getTitleFont();
	if (font==null) {
		font = UIManager.getFont("TitledBorder.font"); //$NON-NLS-1$
	}
  font = getResizedFont(font, factor);
  b.setTitleFont(font);
}
 
Example #26
Source File: Test4243289.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name
    TitledBorder border = BorderFactory.createTitledBorder(
            BorderFactory.createEtchedBorder(),
            "Panel Title", // NON-NLS: the title of the border
            TitledBorder.DEFAULT_JUSTIFICATION,
            TitledBorder.DEFAULT_POSITION,
            font);

    JPanel panel = new JPanel();
    panel.setBorder(border);
    getContentPane().add(panel);
}
 
Example #27
Source File: Test7022041.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleColor()
  */
private static void checkTitleColor() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Color defaultColor = UIManager.getLookAndFeelDefaults().getColor("TitledBorder.titleColor");
    Color titledBorderColor = titledBorder.getTitleColor();

    // check default configuration
    if (defaultColor == null) {
        if (titledBorderColor == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default color should be null");
        }
    }
    if (!defaultColor.equals(titledBorderColor)) {
        throw new RuntimeException("L&F default color " + defaultColor.toString()
                                 + " differs from TitledBorder color " + titledBorderColor.toString());
    }

    // title color is explicitly specified
    Color color = Color.green;
    titledBorder.setTitleColor(color);
    if (!color.equals(titledBorder.getTitleColor())) {
        throw new RuntimeException("TitledBorder color should be " + color.toString());
    }

    // title color is unspecified
    titledBorder.setTitleColor(null);
    if (!defaultColor.equals(titledBorder.getTitleColor())) {
        throw new RuntimeException("L&F default color " + defaultColor.toString()
                                 + " differs from TitledBorder color " + titledBorderColor.toString());
    }
}
 
Example #28
Source File: javax_swing_border_TitledBorder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected TitledBorder getObject() {
    return new TitledBorder(
            new EmptyBorder(1, 2, 3, 4),
            "TITLE",
            TitledBorder.CENTER,
            TitledBorder.ABOVE_TOP,
            new Font("Arial", Font.ITALIC, 12),
            Color.RED);
}
 
Example #29
Source File: ThreeDBalloonPanel.java    From importer-exporter with Apache License 2.0 5 votes vote down vote up
@Override
public void doTranslation() {
	((TitledBorder)contentSourcePanel.getBorder()).setTitle(Language.I18N.getString("pref.kmlexport.balloon.contentSource.border"));	

	includeDescription.setText(Language.I18N.getString("pref.kmlexport.balloon.label.includeDescription"));
	genAttribRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttrib"));
	fileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.file"));
	genAttribAndFileRadioButton.setText(Language.I18N.getString("pref.kmlexport.balloon.label.genAttribAndFile"));
	browseButton.setText(Language.I18N.getString("common.button.browse"));
	contentInSeparateFile.setText(Language.I18N.getString("pref.kmlexport.balloon.label.contentInSeparateFile"));
	warningLabel.setText(Language.I18N.getString("pref.kmlexport.balloon.label.warningLabel"));
}
 
Example #30
Source File: Test4243289.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void init() {
    Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name
    TitledBorder border = BorderFactory.createTitledBorder(
            BorderFactory.createEtchedBorder(),
            "Panel Title", // NON-NLS: the title of the border
            TitledBorder.DEFAULT_JUSTIFICATION,
            TitledBorder.DEFAULT_POSITION,
            font);

    JPanel panel = new JPanel();
    panel.setBorder(border);
    getContentPane().add(panel);
}