Java Code Examples for javax.swing.border.TitledBorder#setTitle()

The following examples show how to use javax.swing.border.TitledBorder#setTitle() . 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: SampleBrowser.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
protected void update ()
{
    final int selectionCount = list.getSelectedIndices().length;

    // Title
    final TitledBorder border = (TitledBorder) getBorder();
    border.setTitle(title + ((selectionCount > 0) ? (": " + selectionCount) : ""));
    repaint();

    // Buttons
    selectAll.setEnabled(model.size() > 0);
    cancelAll.setEnabled(selectionCount > 0);

    // Notify listener if any
    if (listener != null) {
        listener.stateChanged(null);
    }
}
 
Example 2
Source File: DoubleBoundedRangeSlider.java    From jsyn with Apache License 2.0 5 votes vote down vote up
protected void updateTitle() {
    TitledBorder border = (TitledBorder) getBorder();
    if (border != null) {
        border.setTitle(generateTitleText());
        repaint();
    }
}
 
Example 3
Source File: GrammarvizChartPanel.java    From grammarviz2_src with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates the chart panel, puts it on display.
 * 
 */
public void resetChartPanel() {

  // this is the new "insert" - elastic boundaries chart panel
  //
  if (null == this.session.chartData && null != this.tsData) {
    paintTheChart(this.tsData);
  }
  else {
    paintTheChart(this.session.chartData.getOriginalTimeseries());
  }

  // reset the border label
  //
  TitledBorder tb = (TitledBorder) this.getBorder();
  tb.setTitle(LABEL_DEFAULT);

  // instantiate and adjust the chart panel
  //
  chartPanel = new ChartPanel(this.chart);

  chartPanel.setMaximumDrawHeight(this.getParent().getHeight());
  chartPanel.setMaximumDrawWidth(this.getParent().getWidth());
  chartPanel.setMinimumDrawWidth(0);
  chartPanel.setMinimumDrawHeight(0);

  chartPanel.setMouseWheelEnabled(true);

  // cleanup all the content
  //
  this.removeAll();

  // put the chart on show
  //
  this.add(chartPanel);

  // make sure all is set
  //
  this.revalidate();
}
 
Example 4
Source File: DatabaseController.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
protected void setDbTreeTitle( String title ) {
    Border databaseTreeViewBorder = _databaseTreeView.getBorder();
    if (databaseTreeViewBorder instanceof TitledBorder) {
        TitledBorder tBorder = (TitledBorder) databaseTreeViewBorder;
        tBorder.setTitle(title);
        _databaseTreeView.repaint();
        _databaseTreeView.invalidate();
    }
}
 
Example 5
Source File: GeopaparazziController.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
protected void setDbTreeTitle( String title ) {
    Border databaseTreeViewBorder = _databaseTreeView.getBorder();
    if (databaseTreeViewBorder instanceof TitledBorder) {
        TitledBorder tBorder = (TitledBorder) databaseTreeViewBorder;
        tBorder.setTitle(title);
    }
}
 
Example 6
Source File: DoubleBoundedRangeSlider.java    From jsyn with Apache License 2.0 5 votes vote down vote up
protected void updateTitle() {
    TitledBorder border = (TitledBorder) getBorder();
    if (border != null) {
        border.setTitle(generateTitleText());
        repaint();
    }
}
 
Example 7
Source File: ChatUserForm.java    From floobits-intellij with Apache License 2.0 5 votes vote down vote up
public void updateBorder() {
    TitledBorder border = (TitledBorder) containerPanel.getBorder();
    String usernameStr = username;
    if (following) {
        usernameStr += "*";
    }
    border.setTitle(usernameStr);
    containerPanel.validate();
}
 
Example 8
Source File: ExternalConflictInfoPanel.java    From ghidra with Apache License 2.0 4 votes vote down vote up
/**
 * Call this to set the phase of the Listing merge that you are in currently.
 * @param conflictType the type of conflict being resolved by this phase
 * (for example, Symbols).
 */
void setConflictType(String conflictType) {
	this.conflictType = conflictType;
	TitledBorder tBorder = (TitledBorder) getBorder();
	tBorder.setTitle("Resolve " + conflictType + " Conflict");
}
 
Example 9
Source File: ConflictInfoPanel.java    From ghidra with Apache License 2.0 4 votes vote down vote up
/**
 * Call this to set the phase of the Listing merge that you are in currently.
 * @param conflictType the type of conflict being resolved by this phase
 * (for example, Symbols).
 */
void setConflictType(String conflictType) {
	this.conflictType = conflictType;
	TitledBorder tBorder = (TitledBorder) getBorder();
	tBorder.setTitle("Resolve " + conflictType + " Conflict");
}
 
Example 10
Source File: SampleListing.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Empty and regenerate the whole content of SampleListing.
 *
 * @param samples the whole sequence of samples to display (assumed to be ordered by shape)
 */
void populateWith (List<Sample> samples)
{
    scrollablePanel.removeAll(); // Remove all ShapePane instances

    browser.publishSample(null); // Deselect any sample

    // Rebuild ShapePane instances as needed
    Shape currentShape = null;
    List<Sample> shapeSamples = new ArrayList<>();

    for (Sample sample : samples) {
        final Shape shape = sample.getShape();

        // End of a shape collection?
        if ((currentShape != null) && (currentShape != shape)) {
            scrollablePanel.add(new ShapePane(currentShape, shapeSamples));
            shapeSamples.clear();
        }

        currentShape = shape;
        shapeSamples.add(sample);
    }

    // Last shape
    if ((currentShape != null) && !shapeSamples.isEmpty()) {
        scrollablePanel.add(new ShapePane(currentShape, shapeSamples));
    }

    TitledBorder border = (TitledBorder) getBorder();
    int sampleCount = samples.size();
    border.setTitle(title + ((sampleCount > 0) ? (": " + sampleCount) : ""));
    validate();
    repaint();

    // Pre-select the very first sample of the very first ShapePane
    if (!samples.isEmpty()) {
        ShapePane shapePane = (ShapePane) scrollablePanel.getComponent(0);
        shapePane.list.setSelectedIndex(0);
    }
}
 
Example 11
Source File: FieldTypePanel.java    From jeddict with Apache License 2.0 4 votes vote down vote up
private void initTypeComboBox() {
        TitledBorder titledBorder = (TitledBorder) jLayeredPane1.getBorder();
//        type_LayeredPane.setVisible(false);
        List<String> type = new ArrayList<>();
        type.add(DEFAULT);
        if (mapKey) {
            type.add(ENUMERATED);
            type.add(TEMPORAL);
            type.add(ENTITY);
            type.add(EMBEDDABLE);
            titledBorder.setTitle("MapKey Attribute");
        } else if (attribute instanceof PersistenceBaseAttribute) {
            type.add(TEMPORAL);
            if (attribute instanceof Basic) {
                type.add(ENUMERATED);
                type.add(LOB);
                titledBorder.setTitle("Basic Attribute");
            } else if (attribute instanceof Id) {
                titledBorder.setTitle("Id Attribute");
            } else if (attribute instanceof Version) {
                titledBorder.setTitle("Version Attribute");
            }
        } else if (attribute instanceof ElementCollection) {
            type.add(ENUMERATED);
            type.add(LOB);
            type.add(TEMPORAL);
            titledBorder.setTitle("ElementCollection<Basic> Attribute");
        } else if (attribute instanceof Transient) {
            titledBorder.setTitle("Transient Attribute");
        } else if (attribute instanceof BeanAttribute || attribute instanceof BeanCollectionAttribute) {
            titledBorder.setTitle("Attribute");
        }

        type_ComboBox.removeAllItems();
        type_ComboBox.setModel(new DefaultComboBoxModel(type.toArray(new String[0])));
//        if(type.size() == 1){
//            type_LayeredPane.setVisible(false);
//        }
        //ElementCollection[Basic Type Value] => Lob,Enumerated,Temporal
        //Id => Temporal
    }
 
Example 12
Source File: AttachmentDialog.java    From tracker with GNU General Public License v3.0 4 votes vote down vote up
/**
   * Updates this dialog to show the system's current attachments.
   */
  protected void refreshGUI() {
    setTitle(TrackerRes.getString("AttachmentInspector.Title")); //$NON-NLS-1$
    helpButton.setText(TrackerRes.getString("Dialog.Button.Help")); //$NON-NLS-1$  
    closeButton.setText(TrackerRes.getString("Dialog.Button.Close")); //$NON-NLS-1$
    dummyMass.setName(TrackerRes.getString("DynamicSystemInspector.ParticleName.None")); //$NON-NLS-1$
  	startLabel.setText(TrackerRes.getString("AttachmentInspector.Label.StartFrame")); //$NON-NLS-1$
  	countLabel.setText(TrackerRes.getString("AttachmentInspector.Label.FrameCount")); //$NON-NLS-1$
  	stepsButton.setText(TrackerRes.getString("AttachmentInspector.Button.Steps")); //$NON-NLS-1$
  	tracksButton.setText(TrackerRes.getString("AttachmentInspector.Button.Tracks")); //$NON-NLS-1$
  	relativeCheckbox.setText(TrackerRes.getString("AttachmentInspector.Checkbox.Relative")); //$NON-NLS-1$
  	stepsButton.setToolTipText(TrackerRes.getString("AttachmentInspector.Button.Steps.Tooltip")); //$NON-NLS-1$
  	tracksButton.setToolTipText(TrackerRes.getString("AttachmentInspector.Button.Tracks.Tooltip")); //$NON-NLS-1$
  	relativeCheckbox.setToolTipText(TrackerRes.getString("AttachmentInspector.Checkbox.Relative.Tooltip")); //$NON-NLS-1$
    TitledBorder border = (TitledBorder)circleFitterPanel.getBorder();
  	border.setTitle(TrackerRes.getString("AttachmentInspector.Border.Title.AttachTo")); //$NON-NLS-1$
    
  	// refresh layout to include/exclude circle fitter items
  	boolean hasCircleFitterPanel = attachmentsPanel.getComponentCount()>2;
  	boolean hasStartStopPanel = circleFitterPanel.getComponentCount()>1;
  	boolean changedLayout = false;
		TTrack measuringTool = TTrack.getTrack(trackID);
  	if (measuringTool instanceof CircleFitter) {
      // put circleFitter panel in attachments panel SOUTH
      changedLayout = !hasCircleFitterPanel;
      attachmentsPanel.add(circleFitterPanel, BorderLayout.SOUTH);

      CircleFitter fitter = (CircleFitter)measuringTool;
      if (!fitter.attachToSteps) {
        changedLayout = changedLayout || hasStartStopPanel;
        circleFitterPanel.remove(circleFitterStartStopPanel);      	
      }
      else {
      	if (fitter.isRelativeFrameNumbers) {
//      		startLabel.setText(TrackerRes.getString("AttachmentInspector.Label.Offset")); //$NON-NLS-1$
      	}
        changedLayout = changedLayout || !hasStartStopPanel;
        circleFitterPanel.add(circleFitterStartStopPanel, BorderLayout.CENTER);      	
      }
  	}
  	else {
      attachmentsPanel.remove(circleFitterPanel);
      changedLayout = hasCircleFitterPanel;
  	}
  	if (changedLayout) {
  		pack();
  	}
    repaint();
  }
 
Example 13
Source File: Utility.java    From freecol with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Localize the a titled border.
 *
 * @param component The {@code JComponent} to localize.
 * @param template The {@code StringTemplate} to use.
 */
public static void localizeBorder(JComponent component,
                                  StringTemplate template) {
    TitledBorder tb = (TitledBorder)component.getBorder();
    tb.setTitle(Messages.message(template));
}