Java Code Examples for javax.swing.JLabel

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 3Dto2DApplet, under directory /src/java/nl/dannyarends/generator/model/.

Source file: Builder.java

  18 
vote

private static void createAndShowGUI(){
  frame=new JFrame("Model Builder");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JLabel label=new JLabel("Model Builder");
  frame.getContentPane().add(label);
  frame.pack();
  frame.setVisible(true);
}
 

Example 2

From project addis, under directory /application/src/main/java/org/drugis/addis/gui/builder/.

Source file: ClinicalScaleRenderer.java

  18 
vote

private JPanel buildRiskClinicalView(RiskScalePresentation cpm){
  JPanel panel=new JPanel(new FlowLayout());
  addPropertyToPanel(cpm,panel,"Risk: ",OddsRatioScalePresentation.PROPERTY_RISK);
  addPropertyToPanel(cpm,panel,"RD: ",OddsRatioScalePresentation.PROPERTY_RISK_DIFFERENCE);
  JLabel label=BasicComponentFactory.createLabel(cpm.getModel(OddsRatioScalePresentation.PROPERTY_NNT_LABEL));
  JLabel valueLabel=BasicComponentFactory.createLabel(cpm.getModel(OddsRatioScalePresentation.PROPERTY_NNT),new NumberAndIntervalFormat());
  panel.add(label);
  panel.add(valueLabel);
  return panel;
}
 

Example 3

From project Agot-Java, under directory /src/main/java/got/ui/.

Source file: FamilyCharacterDialog.java

  18 
vote

private JComponent familyCharacter(String charName){
  JPanel panel=new JPanel(false);
  panel.setLayout(new GridLayout(1,2));
  JLabel nameLabel=new JLabel(charName);
  panel.add(nameLabel);
  CharacterInfo characterInfo=node.getGameInfo().getCharacterMap().get(charName);
  String des=String.format("<html><B>Power</B> : %d <br><br> <B>Sword</B> : %d <br><br> <B>Sheild</B> : %d <br><br> <B>Speical</B> : %s <br><br></html>",characterInfo.getPower(),characterInfo.getSword(),characterInfo.getShield(),characterInfo.getSpecial());
  JLabel desLabel=new JLabel(des);
  panel.add(desLabel);
  return panel;
}
 

Example 4

From project Android-DB-Editor, under directory /src/com/troido/dbeditor/.

Source file: CellRenderer.java

  18 
vote

@Override public Component getTreeCellRendererComponent(JTree tree,Object value,boolean selected,boolean expanded,boolean leaf,int row,boolean hasFocus){
  JLabel label=new JLabel();
  TreeObject obj=(TreeObject)((DefaultMutableTreeNode)value).getUserObject();
  label.setIcon(new ImageIcon(getClass().getResource("/" + obj.getIconPath())));
  label.setText(obj.getName());
  return label;
}
 

Example 5

From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.

Source file: IcolForm.java

  18 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  final Component cellRendererComponent=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if (cellRendererComponent instanceof JLabel && value instanceof AeArea) {
    final JLabel label=(JLabel)cellRendererComponent;
    final AeArea aeArea=(AeArea)value;
    label.setText(aeArea.getLabel());
  }
  return cellRendererComponent;
}
 

Example 6

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/binding/internal/.

Source file: RangeEditor.java

  18 
vote

private static JLabel createSliderLabel(String text){
  JLabel label=new JLabel(text);
  Font oldFont=label.getFont();
  Font newFont=oldFont.deriveFont(oldFont.getSize2D() * 0.85f);
  label.setFont(newFont);
  return label;
}
 

Example 7

From project charts4j, under directory /src/test/java/com/googlecode/charts4j/example/.

Source file: SwingExample.java

  18 
vote

/** 
 * Display the chart in a swing window.
 * @param urlString the url string to display.
 * @throws IOException
 */
private static void displayUrlString(final String urlString) throws IOException {
  JFrame frame=new JFrame();
  JLabel label=new JLabel(new ImageIcon(ImageIO.read(new URL(urlString))));
  frame.getContentPane().add(label,BorderLayout.CENTER);
  frame.pack();
  frame.setVisible(true);
}
 

Example 8

From project Clotho-Core, under directory /ClothoProject/ClothoCore/src/org/clothocore/util/basic/.

Source file: ObjBasePopup.java

  18 
vote

private void addJumpToSeparator(JComponent pooper){
  JLabel jumplabel=new JLabel();
  jumplabel.setText("Jump To:");
  jumplabel.setFont(new Font("Arial",Font.ITALIC,10));
  pooper.add(jumplabel);
  JSeparator jsep2=new JSeparator();
  pooper.add(jsep2);
}
 

Example 9

From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/.

Source file: BroadcastSectionsDetailWindow.java

  18 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int idx,boolean selected,boolean focus){
  JLabel label=(JLabel)super.getListCellRendererComponent(list,value,idx,selected,focus);
  if (value != null) {
    GuiPreference guiPreference=guiPrefManager.getPreferenceFor((String)value);
    String rendererLabel=guiPreference.getFamilyLabel();
    label.setText(rendererLabel);
  }
  return label;
}
 

Example 10

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/configuration/.

Source file: ConfigurationDialog.java

  18 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  JLabel label=(JLabel)renderer.getListCellRendererComponent(list,getRendererValue(value),index,isSelected,cellHasFocus);
  UserTreatment usrTrt=(UserTreatment)value;
  try {
    TreatmentModel trtMod=getTreatmentModel(usrTrt.getId());
    if (trtMod.isConfigurable(exclude)) {
      label.setFont(label.getFont().deriveFont(Font.BOLD));
    }
  }
 catch (  RequestException e) {
    ;
  }
  return label;
}
 

Example 11

From project codjo-imports, under directory /codjo-imports-gui/src/main/java/net/codjo/imports/gui/wizard/.

Source file: ImportWizardSummaryGui.java

  18 
vote

public ImportWizardSummaryGui(GuiContext guiContext){
  TranslationNotifier translationNotifier=InternationalizationUtil.retrieveTranslationNotifier(guiContext);
  JLabel fileLabel=new JLabel("Fichier :");
  translationNotifier.addInternationalizableComponent(fileLabel,"ImportWizardSummaryGui.fileLabel");
  guiPanel.addItem(fileLabel,filePath);
  JLabel typeLabel=new JLabel("Type :");
  translationNotifier.addInternationalizableComponent(typeLabel,"ImportWizardSummaryGui.typeLabel");
  guiPanel.addItem(typeLabel,fileType);
}
 

Example 12

From project dawn-isencia, under directory /com.isencia.passerelle.engine/src/main/java/com/isencia/passerelle/actor/gui/.

Source file: PasserelleQuery.java

  18 
vote

public void addFileChooser(String name,String label,String defaultName,URI base,File startingDirectory,FileFilter fileFilter,Color background,Color foreground){
  JLabel lbl=new JLabel(label + ": ");
  lbl.setBackground(_background);
  QueryFileChooser fileChooser=new QueryFileChooser(name,defaultName,base,startingDirectory,fileFilter,background,foreground);
  _addPair(name,lbl,fileChooser,fileChooser);
}
 

Example 13

From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogBrokerMonitor.java

  18 
vote

protected JPanel createStatusArea(){
  JPanel statusArea=new JPanel();
  JLabel status=new JLabel("No log records to display.");
  _statusLabel=status;
  status.setHorizontalAlignment(JLabel.LEFT);
  statusArea.setBorder(BorderFactory.createEtchedBorder());
  statusArea.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
  statusArea.add(status);
  return (statusArea);
}
 

Example 14

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/app/.

Source file: DroolsPlannerExamplesApp.java

  18 
vote

private Container createContentPane(){
  JPanel contentPane=new JPanel(new BorderLayout(10,10));
  contentPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  JLabel titleLabel=new JLabel("Which example do you want to see?",JLabel.CENTER);
  titleLabel.setFont(titleLabel.getFont().deriveFont(20.0f));
  contentPane.add(titleLabel,BorderLayout.NORTH);
  JScrollPane examplesScrollPane=new JScrollPane(createExamplesPanel());
  examplesScrollPane.getHorizontalScrollBar().setUnitIncrement(20);
  examplesScrollPane.getVerticalScrollBar().setUnitIncrement(20);
  contentPane.add(examplesScrollPane,BorderLayout.CENTER);
  contentPane.add(createDescriptionPanel(),BorderLayout.SOUTH);
  return contentPane;
}
 

Example 15

From project alg-vis, under directory /src/algvis/scapegoattree/.

Source file: GBButtons.java

  17 
vote

@Override public void otherButtons(JPanel P){
  alpha=new JLabel("\u03B1:");
  AS=new JSpinner(new SpinnerNumberModel(1.3,1.01,5,0.1));
  AS.addChangeListener(this);
  P.add(alpha);
  P.add(AS);
}
 

Example 16

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/casemodule/.

Source file: AddImageVisualPanel2.java

  17 
vote

private void customizeComponents(){
  progressLabel=new JLabel();
  infoPanel.setLayout(new BoxLayout(infoPanel,BoxLayout.PAGE_AXIS));
  infoPanel.add(progressLabel);
  infoPanel.add(Box.createRigidArea(new Dimension(10,10)));
}
 

Example 17

From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/baer/ui/.

Source file: BaerUi.java

  17 
vote

/** 
 * Creates all user interface components and sets them to their appropriate default values
 */
private void createUI(){
  int line=0;
  JPanel ioParamPanel=GridBagUtils.createDefaultEmptyBorderPanel();
  GridBagConstraints gbc=GridBagUtils.createConstraints(null);
  addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.INPUT_PRODUCT_PARAM_NAME,line,12,gbc);
  line+=2;
  addParameterToPanel(ioParamPanel,DefaultRequestElementFactory.OUTPUT_PRODUCT_PARAM_NAME,line,12,gbc);
  line+=10;
  final JLabel outFormatLabel=new JLabel(OUT_FORMAT_LABEL);
  _fileFormatCombo=new JComboBox(_fileFormatNames);
  _fileFormatCombo.addActionListener(new ActionListener(){
    public void actionPerformed(    final ActionEvent e){
      updateOutFileType();
    }
  }
);
  GridBagUtils.setAttributes(gbc,"anchor=SOUTHWEST, fill=NONE, insets.top=12, weightx = 0, weighty=0.5, gridy=" + String.valueOf(line++));
  GridBagUtils.addToPanel(ioParamPanel,outFormatLabel,gbc);
  GridBagUtils.setAttributes(gbc,"anchor=NORTHWEST, weighty=0.5, insets.top=0 ,gridy=" + String.valueOf(line++));
  GridBagUtils.addToPanel(ioParamPanel,_fileFormatCombo,gbc);
  JPanel procParamPanel=GridBagUtils.createDefaultEmptyBorderPanel();
  gbc=GridBagUtils.createConstraints(null);
  addParameterToPanel2(procParamPanel,BaerConstants.USE_CLOUD_PARAM_NAME,line++,12,false,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.USE_BAER_PARAM_NAME,line++,2,false,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.USE_ATM_COR_PARAM_NAME,line++,2,false,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.SMAC_PARAM_NAME,line++,12,true,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.AER_PHASE_PARAM_NAME,line++,2,true,gbc);
  addParameterToPanel2(procParamPanel,BaerConstants.BITMASK_PARAM_NAME,line++,12,false,gbc);
  getParameter(BaerConstants.USE_CLOUD_PARAM_NAME).getEditor().setEnabled(false);
  final JTabbedPane tabbedPane=new JTabbedPane();
  tabbedPane.addTab("I/O Parameters",ioParamPanel);
  tabbedPane.addTab("Processing Parameters",procParamPanel);
  _uiComponent=tabbedPane;
}
 

Example 18

From project beanmill_1, under directory /src/main/java/de/cismet/beanmill/filter/.

Source file: ListView.java

  17 
vote

/** 
 * Creates new form ListView.
 * @param fs  DOCUMENT ME!
 */
public ListView(final FilterSet fs){
  initComponents();
  classIcon=new ImageIcon(getClass().getResource("/de/cismet/beanmill/res/class.png"));
  listModel=new DefaultListModel();
  listeners=new Vector<FilterListener>();
  filterSet=fs;
  active=true;
  lstClasses.setModel(listModel);
  lstClasses.setCellRenderer(new DefaultListCellRenderer(){
    @Override public Component getListCellRendererComponent(    final JList arg0,    final Object arg1,    final int arg2,    final boolean arg3,    final boolean arg4){
      final JLabel l=(JLabel)super.getListCellRendererComponent(arg0,arg1,arg2,arg3,arg4);
      l.setIcon(classIcon);
      return l;
    }
  }
);
}
 

Example 19

From project BioMAV, under directory /Behavior/src/nl/ru/ai/projects/parrot/biomav/editor/.

Source file: BehaviorEditor.java

  17 
vote

private void setNewSelectedParameterControlInterface(ParameterControlInterface pcInterface){
  pcInterfacePanelContents.removeAll();
  selectedPCInterface=null;
  if (pcInterface != null) {
    selectedPCInterface=pcInterface;
    final ParameterControlInterface fpcInterface=pcInterface;
    String[] parameterNames=pcInterface.getParameterNames();
    ParameterControlInterface.ParameterTypes[] parameterTypes=pcInterface.getParameterTypes();
    for (int i=0; i < parameterTypes.length; i++) {
      JLabel label=new JLabel(parameterNames[i]);
      pcInterfacePanelContents.add(label);
      final int index=i;
switch (parameterTypes[i]) {
case OPTIONS:
        final JComboBox optionComboBox=new JComboBox(pcInterface.getParameterOptions(i));
      optionComboBox.setEditable(false);
    optionComboBox.setSelectedItem(pcInterface.getParameterValue(i));
  optionComboBox.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      fpcInterface.setParameterValue(index,optionComboBox.getSelectedItem());
      repaint();
    }
  }
);
pcInterfacePanelContents.add(optionComboBox);
break;
}
}
}
pcInterfacePanel.validate();
}
 

Example 20

From project BMach, under directory /src/bmach/ui/gui/components/.

Source file: JAddressPanel.java

  17 
vote

private void initComponents(){
  this.addressLabel=new JLabel("0x00");
  this.addressLabel.setFont(addressFont);
  this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
  this.add(Box.createHorizontalStrut(10));
  this.add(addressLabel);
  this.add(Box.createHorizontalStrut(5));
  this.setPreferredSize(new Dimension(50,30));
}
 

Example 21

From project Calendar-Application, under directory /calendar/.

Source file: MonthView.java

  17 
vote

public void RenderMV(){
  m_middle_panel.removeAll();
  m_bottom_panel.removeAll();
  Calendar cal=Calendar.getInstance();
  cal.set(Calendar.DAY_OF_MONTH,1);
  cal.set(Calendar.MONTH,m_month);
  cal.set(Calendar.YEAR,m_year);
  m_date_label.setText(cal.getDisplayName(Calendar.MONTH,Calendar.LONG,new Locale(Data.GetSettings().Get("locale"))) + " " + m_year);
  while (cal.get(Calendar.DAY_OF_WEEK) != Calendar.MONDAY) {
    cal.add(Calendar.DAY_OF_MONTH,-1);
  }
  for (int i=0; i < MonthView.WEEKS_IN_A_MONTH; i++) {
    for (int j=0; j < MonthView.DAYS_IN_A_WEEK; j++) {
      if (i == 0) {
        JLabel lbl=new JLabel(cal.getDisplayName(Calendar.DAY_OF_WEEK,Calendar.SHORT,new Locale(Data.GetSettings().Get("locale"))));
        lbl.setForeground(Calindrom.dirty_white);
        m_middle_panel.add(lbl);
      }
      JScrollPane spane=new JScrollPane(new DayPanel(cal,m_month,m_year,CalListener));
      spane.setBorder(new EmptyBorder(0,0,0,0));
      m_bottom_panel.add(spane);
      cal.add(Calendar.DAY_OF_MONTH,1);
    }
  }
}
 

Example 22

From project Chess_1, under directory /src/chess/gui/.

Source file: MenuMaker.java

  17 
vote

/** 
 * Constructs a property sheet that shows the editable properties of a given object.
 * @param object the object whose properties are being edited
 */
public PropertySheet(Class[] types,Object[] values){
  this.values=values;
  editors=new PropertyEditor[types.length];
  setLayout(new FormLayout());
  for (int i=0; i < values.length; i++) {
    JLabel label=new JLabel(types[i].getName());
    add(label);
    if (Grid.class.isAssignableFrom(types[i])) {
      label.setEnabled(false);
      add(new JPanel());
    }
 else {
      editors[i]=getEditor(types[i]);
      if (editors[i] != null) {
        editors[i].setValue(values[i]);
        add(getEditorComponent(editors[i]));
      }
 else       add(new JLabel("?"));
    }
  }
}
 

Example 23

From project Cinch, under directory /example/com/palantir/ptoss/cinch/example/demo/.

Source file: DemoView.java

  17 
vote

private void showUi(){
  JFrame frame=new JFrame("Demo");
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLocation(100,100);
  frame.setSize(600,800);
  JPanel controlsPanel=new JPanel();
  controlsPanel.setOpaque(false);
  BoxLayout box=new BoxLayout(controlsPanel,BoxLayout.Y_AXIS);
  controlsPanel.setLayout(box);
  controlsPanel.add(panelOf(new JLabel("Enabling Button:"),demoBooleanCheckBox,demoButton1,demoButton2));
  controlsPanel.add(panelOf(new JLabel("Bind Radio Buttons to boolean:"),trueButton,falseButton));
  controlsPanel.add(new JSeparator());
  controlsPanel.add(panelOf(new JLabel("Bind Radio Buttons to enum:"),fooButton,barButton,bazButton,setToFooButton));
  controlsPanel.add(new JSeparator());
  controlsPanel.add(panelOf(new JLabel("Filtering JList:"),filterText,demoList,changeList,changeSelection,listChangedLabel));
  controlsPanel.add(new JSeparator());
  controlsPanel.add(panelOf(new JLabel("Multiselect JList:"),demoMultiselectList,multiselectContents,selectMulti));
  controlsPanel.add(new JSeparator());
  controlsPanel.add(panelOf(new JLabel("Bind JComboBox:"),comboBox,selItem));
  controlsPanel.add(new JSeparator());
  controlsPanel.add(panelOf(new JLabel("Slider:"),slider,sliderValue,setSlider));
  controlsPanel.add(new JSeparator());
  String text="test\nlabel\ttab";
  JLabel testLabel=new JLabel(text);
  JTextField testField=new JTextField(text);
  controlsPanel.add(panelOf(testLabel,testField));
  controlsPanel.add(panelOf(new JLabel("Custom component:"),pointButton,lineButton,allowDrag,clearButton));
  controlsPanel.add(canvas);
  panel.setLayout(new BorderLayout());
  panel.add(controlsPanel,BorderLayout.NORTH);
  panel.add(canvas,BorderLayout.CENTER);
  frame.setContentPane(panel);
  frame.setVisible(true);
}
 

Example 24

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/editor/.

Source file: ValueListPanel.java

  17 
vote

public ValueListPanel(){
  list.setName("editor.valueList");
  this.setLayout(new BorderLayout());
  this.add(new JLabel("List Of Values"),BorderLayout.NORTH);
  JScrollPane scroll=new JScrollPane(list);
  this.add(scroll,BorderLayout.CENTER);
}
 

Example 25

From project codjo-standalone-common, under directory /src/main/java/net/codjo/gui/broadcast/.

Source file: GuiPreferencesManager.java

  17 
vote

/** 
 * @param label    Le label du champ a modifier
 * @param field    Le champ a modifier
 * @param identify Identifiant du champ.
 */
public void setProperties(Object label,Object field,Object identify){
  GuiFieldProperties guiFieldProperties=getGuiFieldProperties(identify);
  if (label != null) {
    if (label instanceof JLabel) {
      JLabel jlabel=((JLabel)label);
      jlabel.setText(guiFieldProperties.getLabel(jlabel.getText()));
      jlabel.setVisible(guiFieldProperties.isVisible(jlabel.isVisible()));
    }
 else     if (label instanceof AbstractButton) {
      AbstractButton button=((AbstractButton)label);
      button.setText(guiFieldProperties.getLabel(button.getText()));
      button.setVisible(guiFieldProperties.isVisible(button.isVisible()));
    }
 else {
      throw new IllegalArgumentException("Composant inconnu " + label.getClass());
    }
  }
  if (field != null) {
    if (field instanceof JTextComponent) {
      JTextComponent textComponent=((JTextComponent)field);
      textComponent.setEditable(guiFieldProperties.isEditable(textComponent.isEditable()));
      textComponent.setVisible(guiFieldProperties.isVisible(textComponent.isVisible()));
    }
 else     if (field instanceof AbstractButton) {
      AbstractButton button=((AbstractButton)field);
      button.setEnabled(guiFieldProperties.isEditable(button.isEnabled()));
      button.setVisible(guiFieldProperties.isVisible(button.isVisible()));
    }
 else     if (field instanceof JComboBox) {
      JComboBox comboBox=((JComboBox)field);
      comboBox.setEditable(guiFieldProperties.isEditable(comboBox.isEditable()));
      comboBox.setVisible(guiFieldProperties.isVisible(comboBox.isVisible()));
    }
 else {
      throw new IllegalArgumentException("Composant inconnu " + field.getClass());
    }
  }
}
 

Example 26

From project contribution_eevolution_smart_browser, under directory /client/src/org/compiere/apps/.

Source file: ProcessParameterPanel.java

  17 
vote

private void createField(ResultSet rs,int row,int col){
  GridFieldVO voF=GridFieldVO.createParameter(Env.getCtx(),m_WindowNo,rs);
  GridField mField=new GridField(voF);
  m_mFields.add(mField);
  JLabel label=VEditorFactory.getLabel(mField);
  if (label == null) {
    centerPanel.add(Box.createHorizontalStrut(12),new ALayoutConstraint(row,col));
  }
 else {
    centerPanel.add(label,new ALayoutConstraint(row,col));
  }
  VEditor vEditor=VEditorFactory.getEditor(mField,false);
  vEditor.addVetoableChangeListener(this);
  mField.addPropertyChangeListener(vEditor);
  centerPanel.add((Component)vEditor,new ALayoutConstraint(row,col + 1));
  m_vEditors.add(vEditor);
  Object defaultObject=mField.getDefault();
  mField.setValue(defaultObject,true);
  if (voF.isRange) {
    JLabel dash=new JLabel(" - ");
    centerPanel.add(dash,new ALayoutConstraint(row,col + 2));
    m_separators.add(dash);
    GridFieldVO voF2=GridFieldVO.createParameter(voF);
    GridField mField2=new GridField(voF2);
    m_mFields2.add(mField2);
    VEditor vEditor2=VEditorFactory.getEditor(mField2,false);
    mField2.addPropertyChangeListener(vEditor2);
    centerPanel.add((Component)vEditor2,new ALayoutConstraint(row,col + 3));
    m_vEditors2.add(vEditor2);
    Object defaultObject2=mField2.getDefault();
    mField2.setValue(defaultObject2,true);
  }
 else {
    m_separators.add(null);
    m_mFields2.add(null);
    m_vEditors2.add(null);
  }
}
 

Example 27

From project cp-common-utils, under directory /src/com/clarkparsia/common/net/.

Source file: VisualAuthenticator.java

  17 
vote

/** 
 * @inheritDoc
 */
@Override protected PasswordAuthentication getPasswordAuthentication(){
  JTextField aUser=new JTextField();
  JTextField aPassword=new JPasswordField();
  JLabel aUserLabel=new JLabel("User");
  aUserLabel.setLabelFor(aUserLabel);
  JLabel aPasswordLabel=new JLabel("Password");
  aPasswordLabel.setLabelFor(aPassword);
  JPanel aPanel=new JPanel(new GridLayout(2,2));
  aPanel.add(aUserLabel);
  aPanel.add(aUser);
  aPanel.add(aPasswordLabel);
  aPanel.add(aPassword);
  int aOption=JOptionPane.showConfirmDialog(null,new Object[]{"Host: " + getRequestingHost(),"Realm: " + getRequestingPrompt(),aPanel},"Authorization Required",JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
  if (aOption == JOptionPane.OK_OPTION) {
    return new PasswordAuthentication(aUser.getText(),aPassword.getText().toCharArray());
  }
 else {
    return null;
  }
}
 

Example 28

From project droolsjbpm-integration, under directory /droolsjbpm-integration-examples/src/main/java/org/drools/examples/broker/ui/.

Source file: CompanyPanel.java

  17 
vote

public CompanyPanel(Company model){
  this.model=model;
  GroupLayout formLayout=new GroupLayout(this);
  setLayout(formLayout);
  formLayout.setAutoCreateGaps(true);
  formLayout.setAutoCreateContainerGaps(true);
  JLabel companyNameField=new JLabel(model.getName());
  companyNameField.setFont(companyNameField.getFont().deriveFont(companyNameField.getFont().getSize() + 2.0F));
  JLabel currentLabel=new JLabel("Current: ");
  currentField=new JTextField(format.format(model.getCurrentPrice()),FIELD_COLUMN_SIZE);
  currentField.setEditable(false);
  JLabel previousLabel=new JLabel("Previous:");
  previousField=new JTextField(format.format(model.getPreviousPrice()),FIELD_COLUMN_SIZE);
  previousField.setEditable(false);
  formLayout.setHorizontalGroup(formLayout.createParallelGroup().addComponent(companyNameField).addGroup(formLayout.createSequentialGroup().addGap(10).addComponent(currentLabel).addGap(10).addComponent(currentField)).addGroup(formLayout.createSequentialGroup().addGap(10).addComponent(previousLabel).addGap(10).addComponent(previousField)));
  formLayout.setVerticalGroup(formLayout.createSequentialGroup().addComponent(companyNameField).addGroup(formLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addGap(10).addGroup(formLayout.createSequentialGroup().addComponent(currentLabel).addComponent(previousLabel)).addGap(10).addGroup(formLayout.createSequentialGroup().addComponent(currentField).addComponent(previousField))));
}
 

Example 29

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swing/src/com/toedter/e4/ui/workbench/renderers/swing/.

Source file: StackRenderer.java

  17 
vote

@Override public void processContents(final MElementContainer<MUIElement> container){
  CTabbedPane parentPane=(CTabbedPane)container.getWidget();
  for (  MUIElement element : container.getChildren()) {
    MUILabel mLabel=(MUILabel)element;
    ImageIcon icon=null;
    if (mLabel.getIconURI() != null) {
      try {
        icon=new ImageIcon(new URL(URI.createURI(mLabel.getIconURI()).toString()));
      }
 catch (      MalformedURLException e) {
      }
    }
    JLabel label=new JLabel(mLabel.getLocalizedLabel());
    label.setIcon(icon);
    label.setIconTextGap(5);
    label.setHorizontalTextPosition(SwingConstants.RIGHT);
    parentPane.add((Component)element.getWidget());
    parentPane.setTabComponentAt(parentPane.getTabCount() - 1,label);
  }
}
 

Example 30

From project eclim, under directory /org.eclim.installer/java/org/eclim/installer/step/.

Source file: EclipsePluginsStep.java

  17 
vote

/** 
 * {@inheritDoc}
 * @see org.formic.wizard.step.GuiStep#init()
 */
public Component init(){
  theme=new DesertBlue();
  stepPanel=(JPanel)super.init();
  stepPanel.setBorder(null);
  JPanel panel=new JPanel();
  panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS));
  messageLabel=new JLabel();
  messageLabel.setPreferredSize(new Dimension(25,25));
  panel.add(messageLabel);
  panel.add(stepPanel);
  panel.setBorder(BorderFactory.createEmptyBorder(25,25,10,25));
  return panel;
}
 

Example 31

From project en4j, under directory /NBPlatformApp/NoteContentViewModule/src/main/java/com/rubenlaguna/en4j/NoteContentViewModule/.

Source file: ENMLReplacedElementFactory.java

  17 
vote

private ReplacedElement loadImage(LayoutContext context,String hash){
  ReplacedElement toReturn=null;
  InputStream is=getImage(hash);
  Image image=null;
  if (is == null) {
    return brokenImage(context,100,100);
  }
  try {
    image=ImageIO.read(is);
  }
 catch (  IOException e) {
    LOG.log(Level.WARNING,"exception caught:",e);
  }
 finally {
    try {
      is.close();
    }
 catch (    IOException e) {
    }
  }
  if (image == null) {
    return brokenImage(context,100,100);
  }
  ImageIcon icon=new ImageIcon(image);
  JLabel cc=new JLabel(icon);
  cc.setSize(cc.getPreferredSize());
  FSCanvas canvas=context.getCanvas();
  if (canvas instanceof JComponent) {
    ((JComponent)canvas).add(cc);
  }
  toReturn=new SwingReplacedElement(cc){
    public boolean isRequiresInteractivePaint(){
      return false;
    }
  }
;
  return toReturn;
}
 

Example 32

From project encog-java-workbench, under directory /src/main/java/org/encog/workbench/dialogs/.

Source file: BenchmarkDialog.java

  17 
vote

public BenchmarkDialog(){
  progress=new JProgressBar(0,4);
  setTitle("Please wait, benchmarking Encog.");
  setSize(640,75);
  Container content=this.getContentPane();
  content.setLayout(new BorderLayout());
  this.status=new JLabel("");
  content.add(this.status,BorderLayout.CENTER);
  content.add(progress,BorderLayout.SOUTH);
  Thread thread=new Thread(this);
  thread.start();
}
 

Example 33

From project CBCJVM, under directory /cbc/CBCJVM/src/cbccore/low/.

Source file: CBCSimulator.java

  16 
vote

public CBCSimulator(){
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception e) {
    System.out.println("Error setting native LAF: " + e);
  }
  cbob=new SimulatedCBOB(this);
  sound=new SimulatedSound(this);
  sensor=new SimulatedSensor(this);
  device=new SimulatedDevice(this);
  display=new SimulatedDisplay(this);
  input=new SimulatedInput(this);
  servo=new SimulatedServo(this);
  motor=new SimulatedMotor(this);
  camera=new SimulatedCamera(this);
  create=new SimulatedCreate(this);
  for (int i=0; i < motorSpeedLabels.length; ++i) {
    motorSpeedLabels[i]=new JLabel();
  }
  if (stdOut == null) {
    stdOut=System.out;
  }
  System.out.println("Welcome to CBCJava");
  frame.getContentPane().add(new JScrollPane(display.getTextBox()),BorderLayout.CENTER);
  System.setOut(display.getPrintStream());
  addSidebar();
  addMotorLabels();
  addButtons();
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
  frame.setSize(Math.min(1024,(int)(screenSize.width * .7)),Math.min(768,(int)(screenSize.height * .7)));
  frame.setVisible(true);
  new MotorSpeedUpdater(this,100).start();
}
 

Example 34

From project ChkBugReport, under directory /src/com/sonyericsson/chkbugreport/.

Source file: Gui.java

  16 
vote

public Gui(Main main){
  super("ChkBugReport - (C) 2012 Sony-Ericsson");
  mMain=main;
  JTabbedPane tabs=new JTabbedPane();
  setContentPane(tabs);
  JPanel runPanel=new JPanel(new BorderLayout());
  tabs.addTab("Run",runPanel);
  JPanel runTB=new JPanel();
  runPanel.add(runTB,BorderLayout.NORTH);
  mBtnAdb=new JButton("Fetch from device");
  mBtnAdb.setEnabled(false);
  runTB.add(mBtnAdb);
  mDropArea=new JLabel("Drop a bugreport file here!",JLabel.CENTER);
  runPanel.add(mDropArea,BorderLayout.CENTER);
  mDropArea.setBorder(BorderFactory.createLoweredBevelBorder());
  mDropArea.setTransferHandler(new MyTransferHandler());
  mStatus=new JLabel("Ready.");
  runPanel.add(mStatus,BorderLayout.SOUTH);
  mAdbExt=mMain.findExtension("AdbExtension");
  if (mAdbExt != null) {
    mBtnAdb.setEnabled(true);
    mBtnAdb.addActionListener(this);
  }
  JPanel settingsPanel=new JPanel();
  settingsPanel.setLayout(new BoxLayout(settingsPanel,BoxLayout.Y_AXIS));
  tabs.addTab("Settings",settingsPanel);
  buildSettings(settingsPanel);
  setSize(640,480);
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  setLocationRelativeTo(null);
}
 

Example 35

From project collaborative-editor, under directory /mpedit/gui/.

Source file: CServerDialog.java

  16 
vote

protected void init(){
  super.init();
  JPanel mainPanel=new JPanel(new GridLayout(4,4));
  mainPanel.add(new JLabel("Port:"));
  m_field_port=new JTextField(4);
  m_field_port.setText("2305");
  mainPanel.add(m_field_port);
  mainPanel.add(new JLabel("Username:"));
  m_field_nickname=new JTextField(15);
  mainPanel.add(m_field_nickname);
  mainPanel.add(new JLabel("Password:"));
  m_field_password=new JTextField(15);
  mainPanel.add(m_field_password);
  getContentPane().add(mainPanel,BorderLayout.CENTER);
  this.setSize(400,150);
}
 

Example 36

From project drugis-common, under directory /common-gui/src/main/java/org/drugis/common/gui/.

Source file: BuildViewWhenReadyComponent.java

  16 
vote

public static void main(String[] args) throws InterruptedException {
  JFrame frame=new JFrame();
  JPanel panel=new JPanel(new BorderLayout());
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  ViewBuilder builder=new ViewBuilder(){
    public JComponent buildPanel(){
      return new JLabel("Ok, time for coffee!");
    }
  }
;
  ValueModel readyModel=new ValueHolder(false);
  panel.add(new JLabel("It's supposed to be doing that"),BorderLayout.NORTH);
  panel.add(new BuildViewWhenReadyComponent(builder,readyModel,"Please wait while I sleep"),BorderLayout.CENTER);
  frame.add(panel);
  frame.pack();
  frame.setVisible(true);
  Random gen=new Random();
  for (int i=0; i < 100; ++i) {
    Thread.sleep(gen.nextInt(500));
    readyModel.setValue(gen.nextBoolean());
  }
  System.exit(0);
}
 

Example 37

From project empire-db, under directory /empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/.

Source file: ClientGUI.java

  16 
vote

/** 
 * This method initializes _pnlContent
 * @return javax.swing.JPanel
 */
private JPanel get_pnlContent(){
  if (_pnlContent == null) {
    _lblDepartment=new JLabel();
    _lblDepartment.setText("department");
    _lblDepartment.setSize(new Dimension(100,20));
    _lblDepartment.setLocation(new Point(10,200));
    _lblDepartment.setPreferredSize(new Dimension(100,20));
    lblLastname=new JLabel();
    lblLastname.setPreferredSize(new Dimension(100,20));
    lblLastname.setLocation(new Point(280,200));
    lblLastname.setSize(new Dimension(100,20));
    lblLastname.setText("last Name");
    _lblName=new JLabel();
    _lblName.setText("first Name");
    _lblName.setSize(new Dimension(100,20));
    _lblName.setPreferredSize(new Dimension(100,20));
    _lblName.setLocation(new Point(120,200));
    _pnlContent=new JPanel();
    _pnlContent.setLayout(null);
    _pnlContent.add(get_searchResult(),null);
    _pnlContent.add(get_btnAdd(),null);
    _pnlContent.add(get_txtName(),null);
    _pnlContent.add(get_txtLastname(),null);
    _pnlContent.add(_lblName,null);
    _pnlContent.add(lblLastname,null);
    _pnlContent.add(get_cbxDepartment(),null);
    _pnlContent.add(_lblDepartment,null);
  }
  return _pnlContent;
}
 

Example 38

From project encog-java-core, under directory /src/main/java/org/encog/platformspecific/j2se/.

Source file: TrainingDialog.java

  16 
vote

/** 
 * Construct the training dialog.
 */
public TrainingDialog(){
  this.setSize(320,100);
  setTitle("Training");
  final Container content=getContentPane();
  content.setLayout(new BorderLayout());
  final JPanel statsPanel=new JPanel();
  statsPanel.setLayout(new GridLayout(3,2));
  statsPanel.add(new JLabel("Current Error:"));
  statsPanel.add(this.labelError=new JLabel("Starting..."));
  statsPanel.add(new JLabel("Iterations:"));
  statsPanel.add(this.labelIterations=new JLabel(""));
  statsPanel.add(new JLabel("Training Time:"));
  statsPanel.add(this.labelTime=new JLabel(""));
  content.add(this.buttonStop=new JButton("Stop"),BorderLayout.SOUTH);
  content.add(statsPanel,BorderLayout.CENTER);
  this.buttonStop.addActionListener(this);
}
 

Example 39

From project encog-java-examples, under directory /src/main/java/org/encog/examples/gui/elementary/.

Source file: ElementaryExample.java

  16 
vote

public ElementaryExample(){
  setSize(500,500);
  setTitle("Elementary CA");
  Container c=getContentPane();
  c.setLayout(new BorderLayout());
  JPanel buttonPanel=new JPanel();
  buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
  c.add(buttonPanel,BorderLayout.NORTH);
  c.add(this.status=new JLabel(),BorderLayout.SOUTH);
  buttonPanel.add(new JLabel("Rule:"));
  buttonPanel.add(this.ruleText=new JTextField("110"));
  buttonPanel.add(new JLabel("Size:"));
  buttonPanel.add(this.sizeText=new JTextField("500"));
  buttonPanel.add(generateButton=new JButton("Generate"));
  this.worldArea=new DisplayPanel();
  this.scroll=new JScrollPane(this.worldArea);
  c.add(this.scroll,BorderLayout.CENTER);
  generateButton.addActionListener(this);
  String[] test={"1x","2x","3x","5x","10x"};
  this.zoomCombo=new JComboBox(test);
  buttonPanel.add(new JLabel("Zoom:"));
  buttonPanel.add(zoomCombo);
  zoomCombo.addItemListener(this);
  this.addWindowListener(this);
}
 

Example 40

From project codjo-control, under directory /codjo-control-gui/src/main/java/net/codjo/control/gui/system/.

Source file: SourceSystemWindow.java

  15 
vote

private Component setLabelColor(JLabel label,Object value,boolean isSelected){
  if (label.getForeground().equals(Color.red)) {
    SimpleDateFormat dateFormat=new SimpleDateFormat(value.toString());
    Date currentDate=new Date();
    try {
      dateFormat.format(currentDate);
      if (isSelected) {
        label.setForeground(UIManager.getColor("Table.selectionForeground"));
      }
 else {
        label.setForeground(UIManager.getColor("Table.foreground"));
      }
    }
 catch (    IllegalArgumentException e) {
      label.setForeground(Color.red);
    }
  }
  return label;
}
 

Example 41

From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.

Source file: DefaultTableView.java

  15 
vote

public RowHeaderRenderer(){
  super();
  setHorizontalAlignment(JLabel.CENTER);
  setOpaque(true);
  setBorder(UIManager.getBorder("TableHeader.cellBorder"));
  setBackground(Color.lightGray);
}
 

Example 42

From project dnieprov, under directory /src/org/dnieprov/driver/.

Source file: PasswordGuiCallback.java

  15 
vote

@Override public char[] getPassword(String title,String msg) throws DnieUnexpectedException {
  final JPasswordField jpf=new JPasswordField();
  JOptionPane jop=new JOptionPane(new Object[]{new JLabel("<HTML>" + msg + "<HTML>"),jpf},JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION);
  JDialog dialog=jop.createDialog(title);
  dialog.setAlwaysOnTop(true);
  dialog.addComponentListener(new ComponentAdapter(){
    @Override public void componentShown(    ComponentEvent e){
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          jpf.requestFocusInWindow();
        }
      }
);
    }
  }
);
  dialog.setVisible(true);
  if (jop.getValue() == null) {
    return null;
  }
  int result=(Integer)jop.getValue();
  dialog.dispose();
  if (result == JOptionPane.OK_OPTION) {
    return jpf.getPassword();
  }
  return null;
}