java.awt.Label.setAlignment()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(12.0k)|赞(0)|评价(0)|浏览(296)

本文整理了Java中java.awt.Label.setAlignment()方法的一些代码示例,展示了Label.setAlignment()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setAlignment()方法的具体详情如下:
包路径:java.awt.Label
类名称:Label
方法名:setAlignment

Label.setAlignment介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

text.setAlignment(Align.center);
text.setWrap(true);
final Label text2 = new Label("This is a short string!", skin);
text2.setAlignment(Align.center);
text2.setWrap(true);
final Label text3 = new Label(reallyLongString, skin);
text3.setAlignment(Align.center);
text3.setWrap(true);

代码示例来源:origin: stackoverflow.com

layout.row().expand(false, false).fill(false).colspan(4);

Label playerLabel = new Label(Settings.playerName + "  " + playerScore, skin, "defaultWhite");
layout.add(playerLabel).colspan(1).uniform();

Label historyLabel = new Label(getHistory(), skin, "defaultWhite");
historyLabel.setAlignment(2);
layout.add(historyLabel).colspan(2).expandX();

Label cpuLabel = new Label(cpuScore + "  CPU", skin, "defaultWhite");
layout.add(cpuLabel).colspan(1).uniform();

layout.row();

代码示例来源:origin: com.stevesoft.pat/pat

public TestGroup(String s,boolean b) {
  lab = new Label(s);
  lab.setAlignment(Label.LEFT);
  txt = new TextField();
  txt.setEditable(b);
  ctxt = new ColorText();
  GridBagLayout gb = new GridBagLayout();
  setLayout(gb);
  GridBagConstraints gc = new GridBagConstraints();
  gc.fill = gc.HORIZONTAL;
  gc.gridx = 0; gc.gridy = 0;
  gc.weightx = 0.0; gc.weighty = 0.0;
  gb.setConstraints(lab,gc);
  gc.weightx = 1.0;
  gc.gridx = 1;
  gb.setConstraints(txt,gc);
  gc.fill = gc.BOTH;
  gc.weighty = 1.0;
  gc.gridwidth = 2;
  gc.gridx = 0; gc.gridy = 1;
  gb.setConstraints(ctxt,gc);
  add(lab);
  add(txt);
  add(ctxt);
}
public void ShowRes(Regex r) {

代码示例来源:origin: stackoverflow.com

private static Shell shell;
private static ProgressBar bar;

public static void Pv7(Button ok, Shell shell2) 
{
  shell=shell2;

  if(bar != null && !bar.isDisposed())
    bar.dispose();

  bar = new ProgressBar(shell, SWT.SMOOTH);

  shell.setLayout(new RowLayout()); 
  shell.setSize(1500, 1000);

  pb3.setSelection(500);

  Label label3 = new Label(shell, SWT.NULL);
  label3.setAlignment(SWT.LEFT);
}

public static void disposeProgressBar()
{
  if(bar != null && !bar.idDisposed())
    bar.dispose();
}

代码示例来源:origin: org.w3c.jigsaw/jigsaw

public StepIntegerAttributeEditor() {
StepListener sl = new StepListener();
widget = new Panel(new BorderLayout());
l = new Label();
l.setAlignment(Label.CENTER);
widget.add("Center", l);
p = new Button("+");
p.addActionListener(sl);
widget.add("East", p);
m = new Button("-");
m.addActionListener(sl);
widget.add("West", m);
}

代码示例来源:origin: net.imagej/ij

void addLabel(String text, Label label2) {
  if (label2==null&&IJ.isMacOSX()) text += "    ";
  panel = new Panel();
  c.gridy = y++;
  int bottomInset = IJ.isMacOSX()?4:0;
  c.insets = new Insets(0, 10, bottomInset, 0);
  gridbag.setConstraints(panel, c);
  panel.setLayout(new FlowLayout(label2==null?FlowLayout.CENTER:FlowLayout.LEFT, 0, 0));
  Label label= new TrimmedLabel(text);
  label.setFont(sanFont);
  panel.add(label);
  if (label2!=null) {
    label2.setFont(monoFont);
    label2.setAlignment(Label.LEFT);
    panel.add(label2);
  }
  add(panel);
}

代码示例来源:origin: imagej/ImageJA

void addLabel(String text, Label label2) {
  if (label2==null&&IJ.isMacOSX()) text += "    ";
  panel = new Panel();
  c.gridy = y++;
  int bottomInset = IJ.isMacOSX()?4:0;
  c.insets = new Insets(0, 10, bottomInset, 0);
  gridbag.setConstraints(panel, c);
  panel.setLayout(new FlowLayout(label2==null?FlowLayout.CENTER:FlowLayout.LEFT, 0, 0));
  Label label= new TrimmedLabel(text);
  label.setFont(sanFont);
  panel.add(label);
  if (label2!=null) {
    label2.setFont(monoFont);
    label2.setAlignment(Label.LEFT);
    panel.add(label2);
  }
  add(panel);
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the MessageLabel property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getMessageLabel() {
  if (ivjMessageLabel == null) {
    try {
      ivjMessageLabel = new java.awt.Label();
      ivjMessageLabel.setName("MessageLabel");
      ivjMessageLabel.setAlignment(java.awt.Label.CENTER);
      ivjMessageLabel.setText("Message");
      ivjMessageLabel.setBackground(java.awt.SystemColor.control);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjMessageLabel;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label2 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel2() {
  if (ivjLabel2 == null) {
    try {
      ivjLabel2 = new java.awt.Label();
      ivjLabel2.setName("Label2");
      ivjLabel2.setFont(new java.awt.Font("dialog", 2, 10));
      ivjLabel2.setAlignment(java.awt.Label.CENTER);
      ivjLabel2.setText("Active Requests");
      ivjLabel2.setBounds(4, 22, 80, 12);
      ivjLabel2.setForeground(java.awt.Color.black);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjLabel2;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label2 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getHeaderLabel2() {
  if (ivjHeaderLabel2 == null) {
    try {
      ivjHeaderLabel2 = new java.awt.Label();
      ivjHeaderLabel2.setName("HeaderLabel2");
      ivjHeaderLabel2.setAlignment(java.awt.Label.LEFT);
      ivjHeaderLabel2.setFont(new java.awt.Font("dialog", 2, 10));
      ivjHeaderLabel2.setText("Label2");
      ivjHeaderLabel2.setBackground(java.awt.SystemColor.control);
      ivjHeaderLabel2.setBounds(200, 0, 190, 20);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjHeaderLabel2;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label1 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getCurLabel() {
  if (ivjCurLabel == null) {
    try {
      ivjCurLabel = new java.awt.Label();
      ivjCurLabel.setName("CurLabel");
      ivjCurLabel.setText("");
      ivjCurLabel.setBackground(java.awt.SystemColor.control);
      ivjCurLabel.setFont(new java.awt.Font("dialog", 0, 10));
      ivjCurLabel.setAlignment(1);
      ivjCurLabel.setBounds(0, 115, 25, 12);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjCurLabel;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label1 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getHeaderLabel1() {
  if (ivjHeaderLabel1 == null) {
    try {
      ivjHeaderLabel1 = new java.awt.Label();
      ivjHeaderLabel1.setName("HeaderLabel1");
      ivjHeaderLabel1.setAlignment(java.awt.Label.LEFT);
      ivjHeaderLabel1.setFont(new java.awt.Font("dialog", 2, 10));
      ivjHeaderLabel1.setText("Label1");
      ivjHeaderLabel1.setBackground(java.awt.SystemColor.control);
      ivjHeaderLabel1.setBounds(10, 0, 180, 20);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjHeaderLabel1;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label3 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel3() {
  if (ivjLabel3 == null) {
    try {
      ivjLabel3 = new java.awt.Label();
      ivjLabel3.setName("Label3");
      ivjLabel3.setFont(new java.awt.Font("dialog", 2, 10));
      ivjLabel3.setAlignment(java.awt.Label.CENTER);
      ivjLabel3.setText("Thread Pool");
      ivjLabel3.setBounds(90, 22, 62, 12);
      ivjLabel3.setForeground(java.awt.Color.black);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjLabel3;
}
FillLevelBar _getThreadPoolBar() {

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label1 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel1() {
  if (ivjLabel1 == null) {
    try {
      ivjLabel1 = new java.awt.Label();
      ivjLabel1.setName("Label1");
      ivjLabel1.setFont(new java.awt.Font("dialog", 2, 10));
      ivjLabel1.setAlignment(java.awt.Label.CENTER);
      ivjLabel1.setText("Request Processing");
      ivjLabel1.setBounds(10, 10, 140, 12);
      ivjLabel1.setForeground(java.awt.Color.black);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
  };
  return ivjLabel1;
}
/**

代码示例来源:origin: stackoverflow.com

private void makeHeaderWrappable(TableColumn col) {
 Label label = new Label(col.getText());
 label.setStyle("-fx-padding: 8px;");
 label.setWrapText(true);
 label.setAlignment(Pos.CENTER);
 label.setTextAlignment(TextAlignment.CENTER);

 StackPane stack = new StackPane();
 stack.getChildren().add(label);
 stack.prefWidthProperty().bind(col.widthProperty().subtract(5));
 label.prefWidthProperty().bind(stack.prefWidthProperty());
 col.setGraphic(stack);
}

代码示例来源:origin: stackoverflow.com

for (XYChart.Series<Number, Number> series : bc.getData()) {
   for (XYChart.Data<Number, Number> data : series.getData()) {
     Node bubble = data.getNode();
     if (bubble != null && bubble instanceof StackPane) {
       StackPane region = (StackPane) bubble;
       if (region.getShape() != null && region.getShape() instanceof Ellipse) {
         Ellipse ellipse = (Ellipse) region.getShape();
         DoubleProperty fontSize = new SimpleDoubleProperty(10);
         Label label = new Label(series.getName());
         label.setAlignment(Pos.CENTER);
         label.minWidthProperty().bind(ellipse.radiusXProperty());
         //fontSize.bind(Bindings.when(ellipse.radiusXProperty().lessThan(40)).then(6).otherwise(10));
         fontSize.bind(Bindings.divide(ellipse.radiusXProperty(), 5));
         label.styleProperty().bind(Bindings.concat("-fx-font-size:", fontSize.asString(), ";"));
         region.getChildren().add(label);
       }
     }
   }
 }

代码示例来源:origin: FellowTraveler/otapij

public void init() {
 this.setBackground (Color.lightGray);
 clipboard = getToolkit ().getSystemClipboard ();
 cmdCopy.setLabel("Copy source to clipboard");
 cmdPaste.setLabel ("Paste to the destination field");
 labelSource.setAlignment(Label.RIGHT);
 labelSource.setText("Source text");
 labelDestination.setAlignment(Label.RIGHT);
 labelDestination.setText("Copy to the clipboard");
 this.add(labelSource);
 this.add(sourceText);
 this.add(labelDestination);
 this.add(destinationText);
 this.add(cmdCopy);
 this.add (cmdPaste);
 cmdCopy.addActionListener (new cmdCopyActionListener ());
 cmdPaste.addActionListener (new cmdPasteActionListener ());
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label1 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel1() {
if (ivjLabel1 == null) {
    try {
      ivjLabel1 = new java.awt.Label();
      ivjLabel1.setName("Label1");
      ivjLabel1.setLocation(10, 10);
      ivjLabel1.setText("Active Object");
      ivjLabel1.setBackground(java.awt.SystemColor.control);
      ivjLabel1.setSize(70, 12);
      ivjLabel1.setForeground(java.awt.Color.black);
      ivjLabel1.setFont(new java.awt.Font("dialog", 2, 10));
      ivjLabel1.setAlignment(1);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
};
return ivjLabel1;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label1 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel1() {
if (ivjLabel1 == null) {
    try {
      ivjLabel1 = new java.awt.Label();
      ivjLabel1.setName("Label1");
      ivjLabel1.setLocation(10, 10);
      ivjLabel1.setText("Queue");
      ivjLabel1.setBackground(java.awt.SystemColor.control);
      ivjLabel1.setSize(70, 12);
      ivjLabel1.setForeground(java.awt.Color.black);
      ivjLabel1.setFont(new java.awt.Font("dialog", 2, 10));
      ivjLabel1.setAlignment(1);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
};
return ivjLabel1;
}
/**

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the Label2 property value.
 * @return java.awt.Label
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel2() {
if (ivjLabel2 == null) {
    try {
      ivjLabel2 = new java.awt.Label();
      ivjLabel2.setName("Label2");
      ivjLabel2.setLocation(10, 22);
      ivjLabel2.setText("Map");
      ivjLabel2.setBackground(java.awt.SystemColor.control);
      ivjLabel2.setSize(70, 12);
      ivjLabel2.setForeground(java.awt.Color.black);
      ivjLabel2.setFont(new java.awt.Font("dialog", 2, 10));
      ivjLabel2.setAlignment(1);
      // user code begin {1}
      // user code end
    } catch (java.lang.Throwable ivjExc) {
      // user code begin {2}
      // user code end
      handleException(ivjExc);
    }
};
return ivjLabel2;
}
/**

相关文章