Centering a label

Hi,
I am trying to center a text in a label, but when I am setting alignment to Pos.CENTER or set for label -fx-alignment: CENTER in css - the label is still on the left side.
In javafx 1.3 there was a layoutInfo property, but in 2.0 there is no such property. Any ideas?
Btw, here is my code (in groovy):
class FxApp extends Application {
     * @param args the command line arguments
    static void main(String[] args) {
          Application.launch(FxApp.class, args);
    @Override
    public void start(Stage primaryStage) {
          primaryStage.setTitle("Hello World");
          Region root = new Region();
          def scene = new Scene(root, 300, 250, Color.rgb(242, 242, 242));
          Label lbl = new Label(
               text: "Test",
               alignment: Pos.CENTER,
               height: 250,
               width: 300
          root.getChildren().add(lbl)
        primaryStage.setScene(scene);
        primaryStage.setVisible(true);
}ndrw

In javafx 1.3 there was a layoutInfo property, but in 2.0 there is no such property. Any ideas?In JavaFX 2.0, getChildren() has protected access in Parent and you can't call Region#getChildren() in your code. Try posting Java (not Groovy) code that compiles.
AFAIK Group and Region don't respect layouts. This centers the Label text in a Pane.import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class CenterAlignedLabel extends Application {
  public static void main(String[] args) {
    Application.launch(args);
  @Override
  public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("Hello World");
    Label lbl = new Label("Test");
    lbl.setAlignment(Pos.CENTER);
    lbl.setPrefSize(300, 250);
    Pane root = new Pane();
    root.getChildren().add(lbl);
    Scene scene = new Scene(root, 300, 250, Color.rgb(242, 242, 242));
    primaryStage.setScene(scene);
    primaryStage.setVisible(true);
}db

Similar Messages

  • [svn:fx-trunk] 13263: RadioButton image was incorrectly centered in arcade and zen sample themes .

    Revision: 13263
    Revision: 13263
    Author:   [email protected]
    Date:     2010-01-04 14:07:21 -0800 (Mon, 04 Jan 2010)
    Log Message:
    RadioButton image was incorrectly centered in arcade and zen sample themes. I moved the verticalCenter and left properties to the parent Group to fix this. Also, re-centered the label.
    QE notes: No
    Doc notes: No
    Bugs: SDK-24788
    Reviewer: Deepa
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24788
    Modified Paths:
        flex/sdk/trunk/samples/themes/arcade/src/arcade/skins/RadioButtonSkin.mxml
        flex/sdk/trunk/samples/themes/zen/src/zen/skins/RadioButtonSkin.mxml

  • I need to get Keyboard input as well as mouse input on a JButton

    I need to get Keyboard input as well as mouse input on a JButton
    I have attempted to implement KeyListener. I get the keyCode but I need it to go in to the same String variable as my Actionlistener section.

    Here is the code I have trouble with getting keyboard input as wells as mouse input into the same variable.
    public class Calctester extends JFrame
    implements ActionListener, KeyListener
    private double var1, var2;//var1 and var2 are used to perform calculation
    String operand1 = "";//takes first input until an operator is pressed
    String operand2 = "";//takes input after operator is invoked
    double result;//is used to store the result
    boolean flag = false;//to signal operator pressed
    boolean decimalFlag = false;//to signal decimal pressed
    String stringInput;//used as a temporary store for all entry to allow for conditions to be evaluated
    char ch; //used to store the operator for comparison//Reason is pre does not compare using string
    String pre = "";//used to store the operator
    double mem; //will hold memory operation values
    double vMod; //Temporary store for var2 to be used with percent operations
    //Creates buttons
    JButton btn0 = new JButton("0");
    JButton btn1 = new JButton("1");
    JButton btn2 = new JButton("2");
    JButton btn3 = new JButton("3");
    JButton btn4 = new JButton("4");
    JButton btn5 = new JButton("5");
    JButton btn6 = new JButton("6");
    JButton btn7 = new JButton("7");
    JButton btn8 = new JButton("8");
    JButton btn9 = new JButton("9");
    JButton btnC = new JButton("C");
    JButton btnCE = new JButton("CE");
    JButton btnBkpSpc = new JButton("Backspace");
    JButton btnPlus = new JButton("+");
    JButton btnMinus = new JButton("-");
    JButton btnMultiply = new JButton("*");
    JButton btnDivide = new JButton("/");
    JButton btnEquals = new JButton("=");
    JButton btnPeriod = new JButton(".");
    JButton btnPlusMinus = new JButton("+/-");
    JButton btnSqrt = new JButton("sqrt");
    JButton btnMod = new JButton("%");
    JButton btnOneOverX = new JButton("1/x");
    JButton btnMC = new JButton("MC");
    JButton btnMR = new JButton("MR");
    JButton btnMS = new JButton("MS");
    JButton btnMPlus = new JButton("M+");
    //Displays Text area for Display
    JTextField txtArea = new JTextField("0.");//The calculation display area set to 0.
    JTextField mArea = new JTextField();//to display memory operations
    //Default constructor
    Calctester()
    //Defines a content pane
    Container c = getContentPane();
    //Defines the layout of the frame and sets it to null to allow absolute positioning
    c.setLayout(null);
    //Defines event handling
    btn0.addActionListener(this);
    btn1.addActionListener(this);
    btn2.addActionListener(this);
    btn3.addActionListener(this);
    btn4.addActionListener(this);
    btn5.addActionListener(this);
    btn6.addActionListener(this);
    btn7.addActionListener(this);
    btn8.addActionListener(this);
    btn9.addActionListener(this);
    btnC.addActionListener(this);
    btnCE.addActionListener(this);
    btnBkpSpc.addActionListener(this);
    btnPlus.addActionListener(this);
    btnMinus.addActionListener(this);
    btnDivide.addActionListener(this);
    btnMultiply.addActionListener(this);
    btnEquals.addActionListener(this);
    btnPeriod.addActionListener(this);
    btnPlusMinus.addActionListener(this);
    btnSqrt.addActionListener(this);
    btnMod.addActionListener(this);
    btnOneOverX.addActionListener(this);
    btnMR.addActionListener(this);
    btnMS.addActionListener(this);
    btnMPlus.addActionListener(this);
    btnMC.addActionListener(this);
    btn1.addKeyListener(this);
    //Adds the buttons to the frame and sets the font of the label to be
    //logical font Dialog,plain as opposed to Bold and the label size to 12
    //Also sets the border type of aech button
    c.add(btn0).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn0.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn1).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn1.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn2).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn2.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn3).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn3.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn4).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn4.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn5).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn5.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn6).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn6.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn7).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn7.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn8).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn8.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btn9).setFont(new Font("Dialog", Font.PLAIN, 12));
    btn9.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnC).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnC.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnCE).setFont(new Font("Helvetica", Font.PLAIN, 12));
    btnCE.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnBkpSpc).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnBkpSpc.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnPlus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnPlus.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMinus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMinus.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMultiply).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMultiply.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnDivide).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnDivide.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnEquals).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnEquals.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnPeriod).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnPeriod.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnPlusMinus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnPlusMinus.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMod).setFont(new Font("Albertus Medium", Font.PLAIN, 12));
    btnMod.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnSqrt).setFont(new Font("Microsoft San Serif", Font.PLAIN, 11));
    btnSqrt.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnOneOverX).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnOneOverX.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMC).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMC.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMS).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMS.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMR).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMR.setBorder(new BevelBorder(BevelBorder.RAISED));
    c.add(btnMPlus).setFont(new Font("Dialog", Font.PLAIN, 12));
    btnMPlus.setBorder(new BevelBorder(BevelBorder.RAISED));
    //sets the color of the label of the buttons
    btnC.setForeground(Color.red);
    btnCE.setForeground(Color.red);
    btnBkpSpc.setForeground(Color.red);
    btnDivide.setForeground(Color.red);
    btnMultiply.setForeground(Color.red);
    btnMinus.setForeground(Color.red);
    btnPlus.setForeground(Color.red);
    btnMC.setForeground(Color.red);
    btnMR.setForeground(Color.red);
    btnMS.setForeground(Color.red);
    btnMPlus.setForeground(Color.red);
    btnEquals.setForeground(Color.red);
    btn0.setForeground(Color.blue);
    btn1.setForeground(Color.blue);
    btn2.setForeground(Color.blue);
    btn3.setForeground(Color.blue);
    btn4.setForeground(Color.blue);
    btn5.setForeground(Color.blue);
    btn6.setForeground(Color.blue);
    btn7.setForeground(Color.blue);
    btn8.setForeground(Color.blue);
    btn9.setForeground(Color.blue);
    btnPlusMinus.setForeground(Color.blue);
    btnSqrt.setForeground(Color.blue);
    btnMod.setForeground(Color.blue);
    btnOneOverX.setForeground(Color.blue);
    btn0.setFocusPainted(false);
    btnPlus.setFocusPainted(false);
    btnEquals.setFocusPainted(false);
    //The display text area and the memory operation text area
    c.add(txtArea);
    txtArea.setBorder(new BevelBorder(BevelBorder.LOWERED));
    txtArea.setBounds(7,0,240,25);//To provide a Text box @ the top of the frame
    txtArea.setEditable(false);
    txtArea.setBackground(Color.white);
    c.add(mArea);
    mArea.setBounds(13, 35, 28, 25);
    mArea.setEditable(false);
    mArea.setBorder(new BevelBorder(BevelBorder.LOWERED));
    setSize(260,251);//size of the frame
    setTitle("Calculator"); //Title
    setVisible(true); //this makes the frame visible on the screen
    setResizable(false); //this disallow resizing of the frame
    setDefaultCloseOperation(EXIT_ON_CLOSE);//to close app
    //instead of the above method you can use the WindowsListener which extennds other classes and implements other interfaces.
    setLocation(300,200);//positioning of the window on the screen
    txtArea.setHorizontalAlignment(JTextField.RIGHT);//sets the text in the text field to the right
    mArea.setHorizontalAlignment(JTextField.CENTER);//centers the label
    JMenu editMenu = new JMenu("Edit");//creates menu
    JMenuItem copy = new JMenuItem("Copy Ctrl+C");//creates menu item
    copy.addActionListener(this);//event handling
    JMenuItem paste = new JMenuItem("Paste Ctrl+V");//creates menu
    paste.addActionListener(this);//event handling
    JMenuBar myMenu = new JMenuBar();//declares a menu bar
    setJMenuBar(myMenu);//adds the menu bar to the frame
    editMenu.setBorderPainted(false);//removes the border shadow around the menu bar
    myMenu.setBorderPainted(false);//removes the border shadow around menu bar
    //adds menu items to the menu, sets the font and font size.
    editMenu.add(paste).setFont(new Font("Dialog", Font.PLAIN, 12));//
    editMenu.add(copy).setFont(new Font("Dialog", Font.PLAIN, 12));
    myMenu.add(editMenu).setFont(new Font("Dialog", Font.PLAIN, 12));
    JMenu viewMenu = new JMenu("View");//creates menu
    JMenuItem sci = new JMenuItem("Scientific");//creates menu item
    sci.addActionListener(this);//event handling
    JMenuItem std = new JMenuItem("Standard");//creates menu item
    //adds menu items to the menu, sets the font and font size.
    viewMenu.add(sci).setFont(new Font("Dialog", Font.PLAIN, 12));
    viewMenu.add(std).setFont(new Font("Dialog", Font.PLAIN, 12));
    myMenu.add(viewMenu).setFont(new Font("Dialog", Font.PLAIN, 12));
    JMenu helpMenu = new JMenu("Help");//creates menu
    JMenuItem helpTopics = new JMenuItem("Help Topics");//creates menu item
    JMenuItem aboutCalc = new JMenuItem("About Calculator");//creates menu item
    helpTopics.addActionListener(this);//event handling
    //helpTopics.setBorder(new BevelBorder(BevelBorder.RAISED));
    helpTopics.setBorder(LineBorder.createGrayLineBorder());
    //adds menu items to the menu, sets the font and font size.
    helpMenu.add(helpTopics).setFont(new Font("Dialog", Font.PLAIN, 12));
    helpMenu.add(aboutCalc).setFont(new Font("Dialog", Font.PLAIN, 12));
    myMenu.add(helpMenu).setFont(new Font("Dialog", Font.PLAIN, 12));
    //aboutCalc.setBorder(new BevelBorder(BevelBorder.RAISED));
    aboutCalc.setBorder(LineBorder.createGrayLineBorder());
    //aboutCalc.setActionCommand("Nothing here right now");
    //Setting absolute positions for the buttons.
    btn0.setBounds(50, 160, 35, 28);
    btn1.setBounds(50, 130, 35, 28);
    btn2.setBounds(90, 130, 35, 28);
    btn3.setBounds(130, 130, 35, 28);
    btn4.setBounds(50, 100, 35, 28);
    btn5.setBounds(90, 100, 35, 28);
    btn6.setBounds(130, 100, 35, 28);
    btn7.setBounds(50, 70, 35, 28);
    btn8.setBounds(90, 70, 35, 28);
    btn9.setBounds(130, 70, 35, 28);
    btnC.setBounds(180, 35, 63, 28);
    btnCE.setBounds(115, 35, 63, 28);
    btnBkpSpc.setBounds(50, 35, 63, 28);
    btnPlus.setBounds(170, 160, 35, 28);
    btnMinus.setBounds(170, 130, 35, 28);
    btnMultiply.setBounds(170, 100, 35, 28);
    btnDivide.setBounds(170, 70, 35, 28);
    btnEquals.setBounds(210, 160, 35, 28);
    btnPeriod.setBounds(130, 160, 35, 28);
    btnPlusMinus.setBounds(90, 160, 35, 28);
    btnMC.setBounds(8, 70, 35, 28);
    btnMR.setBounds(8, 100, 35, 28);
    btnMS.setBounds(8, 130, 35, 28);
    btnMPlus.setBounds(8, 160, 35, 28);
    btnSqrt.setBounds(210, 70, 35, 28);
    btnMod.setBounds(210, 100, 35, 28);
    btnOneOverX.setBounds(210, 130, 35, 28);
    // btn7.addKeyListener(this);
    try
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    SwingUtilities.updateComponentTreeUI(this);
    catch (Exception e)
    System.out.println("Could not load Metal Look and Feel");
    public void keyReleased(KeyEvent e)
    //btn1 = txtArea.getRegisteredKeyStrokes();
    // System.out.println(1);
    // keyTyped();
    public void keyPressed(KeyEvent e)
    //if (e.getActionCommand().equals("1"));
    //(e.getKeyText().compareTo("1"));
    //(e.getKeyCode().equals("1"));
    //else
    System.out.println("Error");
    //keyTyped();
    public void keyTyped(KeyEvent e)
    //displayInfo(e, "KEY TYPED: ");
    System.err.println("KeyTyped >>> " + e.KEY_TYPED);
    //keyEvent.keyTyped();
    // e.KEY_TYPED;
    /* protected void displayInfo (KeyEvent e, string s)
    {KeyCodeString;
    int keyCode = e.getKeyCode();
    keyCodeString = "key code " + keyCode
    + "("
    + KeyEvent.getKeyText(keyCode);
    public void actionPerformed(ActionEvent e)
    stringInput = e.getActionCommand();
    System.out.println("First stringInput action performed>>" +stringInput);
    System.out.println("First pre action performed>>" +pre);
    if (stringInput == "C")
    operand1 = "";
    operand2 = "";
    var1 = 0;
    var2 = 0;
    var1 = result;
    txtArea.setText("0.");
    flag = false;//to force the operations to jump to operand 1 and go through the loop as normal
    pre = "";
    if (stringInput == "CE")
    operand2 = "";
    var2 = 0;
    txtArea.setText("0.");
    flag = true;//to force the operations to jump to operand 1 and go through the loop as normal
    if (stringInput == "MR")
    if (var1 != 0)
    txtArea.setText(Double.toString(var1));
    mArea.setText("M");
    System.err.println("mem@operand1 >> "+ mem );
    else if (var2 != 0)
    txtArea.setText(Double.toString(var2));
    mArea.setText("M");
    System.err.println("mem @ mR else>> "+ mem );
    if (stringInput == "MS")
    mArea.setText("M");
    if (operand1 != "")
    mem = var1;
    else if (operand2 != "")
    mem = var2;
    else
    mem = 0;
    if (stringInput == "MC")
    mArea.setText("");//to clear the text area display
    mem = 0;//to reset the variable
    if (stringInput == "M+")
    mArea.setText("M");
    flag = true;//to force the operations to jump to operand 2 and go through the loop as normal
    if (stringInput == "=")
    //result = evaluate();
    txtArea.setText(Double.toString(result));
    System.out.println("Equals>>" +stringInput);
    System.out.println("Equals>>" +pre);
    System.err.println("The flag at equals is " + flag);
    if (stringInput == "+"||stringInput == "-"||stringInput == "/"||
    stringInput == "*"||stringInput == "=")
    pre = pre.concat(stringInput);
    System.out.println("Second action perfo/check for operator>>" +stringInput);
    System.out.println("Second pre action perfo/check for operator>>" +pre);
    operand2 = "";
    System.err.println("The flag at +,- etc is " + flag);
    if(!flag &&(stringInput == "*"|| stringInput == "/"))
    var2 = 1;
    stringInput = "";
    flag = true;
    if(!flag)
    stringInput = pre;
    System.out.println("if flag true/stringInput" +stringInput);
    System.out.println("flag true/pre" +pre);
    else
    //These statements extract the operator
    stringInput = pre.valueOf(pre.charAt(pre.length()-2));
    ch = pre.charAt(pre.length()-2);
    System.out.println("@ position -2 stringInput" + pre.valueOf(pre.charAt(pre.length()-2)));
    System.out.println("@ position -2 pre" + pre.charAt(pre.length()-2));
    result = evaluate();
    var2 = 0;
    operand2 = "";
    txtArea.setText(Double.toString(result));
    System.out.println("Total is " + result);
    flag = true;
    if(!flag &&(stringInput == "*"|| stringInput == "/"))
    var2 = 1;
    stringInput = "";
    flag = true;
    if (stringInput == "%")
    //evaluate();
    txtArea.setText(Double.toString(result));
    System.err.println("mem @ mR else>> "+ result + " %" );
    if (stringInput == "1/x")
    if (operand1 != "")
    txtArea.setText(Double.toString(1/var1));
    //System.err.println("mem@operand1 >> "+ mem );
    else if (operand2 != "")
    operand2 = "";
    txtArea.setText(Double.toString(1/var2));
    //System.err.println(">> "+ mem );
    if (Character.isDigit(stringInput.charAt(0))||stringInput == ".")
    System.out.println(operand1);
    if (stringInput == "." && operand1 == "")
    operand1 = "0";
    System.out.print("fail op1");
    if (stringInput == "." && operand2 == "")
    System.out.print("fail op2");
    operand2 = "0";
    if (flag==false)
    operand1 = operand1.concat(stringInput);
    result = Double.parseDouble(operand1);
    System.out.println("op1 =>" + operand1);
    txtArea.setText(operand1);
    //result = var1;
    System.out.println("result after var1 = result " + result);
    else
    operand2 = operand2.concat(stringInput);
    var2 = Double.parseDouble(operand2);
    //var2 = vMod;
    System.out.println("op2 =>" + operand2);
    txtArea.setText(" ");//to clear the text area
    txtArea.setText(operand2);//to display the second number if (operators == "+")
    System.out.println("result after var2 " + result);
    public double evaluate()
    if (ch == '+' )
    result = result + var2;
    if (ch == '-' )
    result = result - var2;
    if (ch == '/' )
    result = result / var2;
    if (ch == '*' )
    result = result * var2;
    if (ch == '%')
    var2 = Double.parseDouble(operand2);
    result = result/vMod*100;
    System.out.println("% "+ result);
    return result;
    public static void main(String [] args)
    Calctester x = new Calctester();
    }

  • Text on top of an image in a component

    How do I get text on top of an image in a component?
    ImageIcon icon = new ImageIcon("foo.jpg");
    JLabel label = new JLabel();
    label.setIcon(icon);
    // this prints next to, not on top of, the image
    label.setText("Hello"); if I add this:
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setVerticalAlignment(SwingConstants.CENTER);The text doesn't appear at all. I assume it is "underneath" the image.
    null

    if I add this:
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setVerticalAlignment(SwingConstants.CENTER);The alignment methods determine the position of the component in the parent container, if the layout manager respects those values.
    I believe you want:
    JLabel label = new JLabel("Some Centered Text");
    label.setIcon( new ImageIcon("???.jpg") );
    label.setHorizontalTextPosition(JLabel.CENTER);
    label.setVerticalTextPosition(JLabel.CENTER);

  • How to Print Fields that are Centered on the Label

    Labview 6.1 - Which VI do I call or Attribute do I set to make a String Field "Centered" on its Row on a Zebra Label? I need to specify the String Data, the Font Size and Centered about Position. One Centered field per Row (3 Rows). I am using the NewReport.vi, SetReportOrientation.vi, SetReportFont.vi AppendReportText,vi, PrintReport.vi and DisposeReport.vi

    LabVIEW does support the windows printer driver, I was thrown off by the fact that you said "zebra label." We have a report generation toolkit that will allow you to create more advanced reports and can programatically control microsoft word and excel to create as complex of a document as you desire.
    Our basic report generation toolkit that ships with LabVIEW supports simple reports and layouts. It also allows for HTML reports. You can then append any HTML formatting to the report that you desire (such as the center tag).
    You could also continue to use the standard report by appending spaces to the string you are printing. For example, if you know that your printer is 80 characters wide (using a fixed width font), you can take the size of the string "len" and append (80-len)/2 number of spaces to the string. If you need help doing this, let me know.
    We actually implimented a barcode label printing VI that printed an entire front panel. We created a VI that had an array of controls and we formatted the controls to our desire (one was a centered string). We then used the "print panel vi" in the block diagram. That we we simply wired the inputs to the VI and it printed the front panel to the printer onto the labels (we use this on our large shipments that have more than one item).
    The ActiveX examples that ship with LabVIEW and on our website are very good starting points for creating word reports, but if you are going to use LabVIEW to manipulate Microsoft Word and Excel, I really suggest getting our Report Generation Toolkit for Microsoft Office. The RGT (Report Generation Toolkit) contains a complete set of easy to use VIs to programmatically create and edit Word and Excel documents. The Microsoft Office ActiveX interface is huge, and it is often times hard to find good complete documentation on how to perform certain tasks. The RGT VIs hide all of the ActiveX complexity and really simplify the tasks, but as a developer I really appreciate the fact that the VIs contain all of the ActiveX code on the block diagram so that I can look at them as examples and modify them to my desire. You can find out more about the RGT from ni.com, click on Products, LabVIEW, LabVIEW Addons, LabVIEW Toolsets, LabVIEW Report Generation Toolkit.
    I hope some this gives you an idea you can run with.

  • Has anyone had a problem centering labels from microsoft word 2007 using the hp photosmart 7510? my

    Has anyone had a problem with printing labels centered on HP Photosmart 7510 e-All in one?  My labels are printed from Word 2007 and appear on the screen to be centered, however when I print, they are too high on the label.  Also when printing an e-mail the bottom of the page where it lists your email name is cut off.  Please help!!

    Hi,
    I'd been having this problem for probably round 30 years on many printers. I bought a labels printer few years back but I don't print labels everyday now.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Centering Label Text over front Panel Indicator

    How can I get the Text in the Label of a Front Panel LED Indicator Control in LabVIEW 2009 to be centered over the LED?
    How can I change the Font an Font Size of the Text of a Label?

    Hi,
    Label to be center at the object.
    There are many Ways like
    1) what the JackDunaway has explained  Text Settings Toolbar button.
    2) Other you can dynamically change the property of label.
    Like you can change programmically change label justification, size, color, and many property.
    Just right click on object.Go to creat property node. refer screen shot for more help.
    Thank you.
    CLAD
    Labiew programmer
    Attachments:
    Lebel property.png ‏133 KB
    Lebel property.png ‏133 KB
    Lebel property.png ‏133 KB

  • CD label (centered) edit to fit Fellowes (2 per page) template

    I was given permission to download a CD label for personal use, at present it's centered once on a page. I have Fellowes labels that are space saving two per page. As is, the image would print half on one, half on the other.
    Is there a way to edit/move the image so it will at least fit within the lines of the stickers I have? Thanks!

    Not with Adobe Reader no. Might be possible to set something up in Photoshop if you have it.

  • Centering dynamic length label

    I want to associate a label with a TextField.
    I want the layout to be ...
    LABEL : [TEXTFIELD]
    However, I want to center them both.
    Since I don't know how many characters are in the LABEL at build time, I can't know how wide the LABEL should be ( which makes centering difficult ).
    As an example I might have the following appear, depending on the label.
    7 chars^^^^^^^^^^^^^: [TEXTAREA]
    13 chars here^^^^^^^: [TEXTAREA]
    It is 19 chars wide^: [TEXTAREA]
    As you can see, the text is always left justified. I want to center BOTH of them and not have the trailing spaces.

    Use a FlowLayout to wrap them.
    public class FlowLayout extends Object
    implements LayoutManager, Serializable
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. Flow layouts are typically used to arrange buttons in a panel. It will arrange buttons left to right until no more buttons fit on the same line. Each line is centered.

  • How do I force text in a label to be centered???

    How can I outline the text in a label?
    I can't find a setHorizontalAlginment method or something similar.

    http://java.sun.com/j2se/1.3/docs/api/javax/swing/JLabel.html
    search for CENTER (it can done when the label is constructed or changed later by setVerticalAlignment)

  • Label Is not centering in a column chart

    I want to center the value on a column graph,i used LabelStyle for this but this is not working exactly.
    <asp:Chart ID="bargraphconsldtd" runat="server" EnableViewState="true" Width="600px" style="padding:10px;">
    <Series>
    <asp:Series Name="Overall Potential" CustomProperties="LabelStyle= Center" IsVisibleInLegend="true" Color="#399BFF" ToolTip="Overall Potential:#VALY" ChartType="Column" ></asp:Series>
    </Series>
    <Series>
    <asp:Series Name="Potential Value" CustomProperties="LabelStyle= Center" IsVisibleInLegend="true" Color="#26A65B" ToolTip="Potential Value:#VALY" ChartType=" Column" ></asp:Series>
    </Series>
    <Series>
    <asp:Series Name="Business Expected" CustomProperties="LabelStyle= Center" IsVisibleInLegend="true" Color="#EF4836" ToolTip="Business Expected:#VALY" ChartType="Column" ></asp:Series>
    </Series>
    <Series>
    <asp:Series Name="Sale Ytd" CustomProperties="LabelStyle= Center" IsVisibleInLegend="true" Color="#F39C12" ToolTip="Sale Ytd:#VALY" ChartType="Column" ></asp:Series>
    </Series>
    <ChartAreas>
    <asp:ChartArea Name="ChartArea1">
    <AxisX >
    <MajorGrid LineWidth="0" />
    </AxisX>
    <AxisY>
    <MajorGrid LineWidth="0" />
    </AxisY>
    </asp:ChartArea>
    </ChartAreas>
    <Legends>
    <asp:Legend></asp:Legend>
    </Legends>
    <%-- <BorderSkin
    SkinStyle="Emboss" />--%>
    </asp:Chart>

    Hi, Ravens Fan --
    The font that you see in the attached file is called "Cambria,"  and yes, I have changed the fonts on the axis labels and scales. I figured that shouldn't matter since the option to do that is so nicely given in the Properties dialog box.
    The overall Windows setting for text size on this computer is "normal."
    I tried going back to the Application font, using it at the same size that I'm using for Cambria (18-point), but it gets cut off the same way.
    Thanks!*
    Mark
    *But not for taking the Texans out of the playoffs last year...

  • Centering text in labels?

    Hello,
    Does anyone know, if we can center the text in a label?
    Thanks

    Does anyone know, if we can center the text in a
    label?Yes, I know if you can center the text. :)
    Look at the setHorizontalAlignment(int) method of the JLabel.

  • Centering a horizontal image with label list...

    Hi there,
    Image list is aligned to the left by default. I'd like to know if it's possible to aligned it to the center of page? If so, please educate me... Thank you in advance...
    Chris :)
    Edited by: Chris K.W. on Dec 11, 2009 8:54 AM

    You've caused very little hassle. Microsoft on the other hand...
    To do this using CSS you have to account for bugs in IE, meaning it takes 4 times longer than it needs to. We won't go into the ensuing unfortunate chain of events involving VMs, but it meant that I couldn't test this on IE8.
    1. Set the template for the containing region to "No Template".
    2. To cope with Microsoft's broken browsers, enter
    <!--[if lt IE 8]>
    <div style="text-align: center;">
    <![endif]-->in the Region Header, and
    <!--[if lt IE 8]>
    </div>
    <![endif]-->in the Region Footer.
    3. Add this internal style sheet to the page HTML Header
    <style type="text/css">
    .t13HorizontalImageswithLabelList {
      margin-left: auto;
      margin-right: auto;
    </style>If it doesn't work in IE8 then try removing 'lt' and '8' in step 2.
    This will center all Horizontal Images with Label Lists on a page: we can change this if necessary, but will skip redundant code if it's not required.

  • Centering and displaying 100% in browser won't work.

    I believe I followed the instructions that were posted previously and I did some reading about centering a page and displaying the page at 100% but I can't seem to make them work correctly. I might have a conflict or something can you help.
    I designed a website which was 1000px wide and now they want it changed (they want an image on both sides of the page)-so instead of changing it around completely and trying to mess with the areas and buffers and all of that fun stuff. I decided to leave the #container (which is were all the data for the site is and were as the template is applied to other pages the size will change -the height will change but the width should stay 100px.)that was there and then wrapp it up completly in another div tag which i labeled #master_container then I inserted 2 more div tags and placed the images on either side as is desired. I followed the instructions above (because now the site is soo big displaying in a browser is diffacult). I need the site to do 3 things.
    -i need it to display centered on the page so that no matter what browser it is displayed in or what size screen it is viewed on it fits the center of the screen.
    -I also would like it to fit the screen of the person using it so that they see the whole page as one and there isn't a huge blank space on one of the sides -right now it is on the right.
    -if you know how to make the two images on the side of the screen scroll as the person scrolls down the page-(ie-so that they don't see part of the image sometimes and other parts of it when they move farther down-wouldl like it to scroll with them as they move down the page)
    HERE IS THE XHTML CODE OF MY SITE:
    <!DO.TYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    </style>
    <link href="../Unicorn_main_layout_template_oldform - CopytestCSS.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="Master_container">
      <div id="ancestor_left"><img src="../Images/ancestor_cropped.jpg" width="659" height="1003" alt="ancestor right" /></div>
      <div class="container">b</div>
      <div id="ancestor_right"><img src="../Images/ancestor_cropped.jpg" width="659" height="1003" alt="ancestor_right" /></div>
    </div>
    </body>
    </html>
    HERE IS THE CSS STYLESHEET ATTACHED TO THE TEMPLATE I AM TRYING TO APPLY TO ALL OF THE PAGES OF THE SITE.
    @charset "utf-8";
    /* CSS Document */
    #body {
        text-align:center;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
    #Master_container {
        width: 2300px;
        margin: 0 auto;
        text-align: left;
        margin-right:auto;
        margin-left:auto;
    #ancestor_left {
        float: left;
        width: 660px;
    .container {
        height: auto;
        width: 1000px;
    #ancestor_right {
        width: 660px;
        float: right;
    THANK YOU VERY MUCH FOR YOUR HELP!!!

    Ok I have no idea what i am doing wrong this is the most frusterating thing I have ever done. I will never build another webpage again.
    Here is the problem that I have i don't care how it gets solved but I just need it solved. this is over a week trying to solve one problem. I just don't have the time to do it anymore but I need it done.
    1) this page (http://practiceuploadingsite.info/) needs to be centered.  That's all just centered in the brosers that it opens in. (nothing I try seems to work)
    2) every other page on that website after you click into the home page (http://practiceuploadingsite.info/Pages/home.html) is made by the application of a template. All I want to do is keep eveything the same as it is right now and just add 2 background images (one on the right and one on the left) so that this:
    fits inside of the blank space of this:
    preferably so the images scroll down the page because the center colum will change height but not widith depending on the page the template is applied to. 
    I even tried to remake the template as to include the images all at once with the div tages and the header seems to have nothing but problems and I couldn't get them to stay together correctly. they keep coming up uneven and the header that is contained on the page spans the entire container and will not just stay the way it is.
    Just please tell me how to do this and you will never hear from me again.
    I am uploading the site information so you have the files I am working from Idk if it is something wrong with the headers the div containers or what but almost just put my computer through the window so I don't care how to get it done just please spell it out so I can follow it correctly.
    THANK YOU!!
    THIS IS THE MAIN LAYOUT TEMPLATE THAT IS APPLIED TO THE WORKING SITE THE WAY I WANT IT EXCEPT FOR THE IMAGES
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Unicorn Main Layout Template</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" -->
    <style type="text/css">
    #container {
        width: 1000px;
    #header {
        width: 1000px;
        text-align:left
    </style>
    <!-- TemplateEndEditable -->
    <link href="../Stylesheet_Unicorn_main_layout_template.css" rel="stylesheet" type="text/css" />
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>css3menu.com</title>
        <!-- Start css3menu.com HEAD section -->
        <link rel="stylesheet" href="CSS3 Menu_files/css3menu1/style.css" type="text/css" /><style type="text/css">._css3m{display:none}</style>
        <!-- End css3menu.com HEAD section -->
    <link href="../Menu_bar_stylesheet.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="container"><!-- TemplateBeginEditable name="header_editable" -->
      <div id="header">Unicorn Writers Conference</div>
    <!-- TemplateEndEditable -->
      <div id="menubar_left">
    <ul id="MenuBar" class="topmenu">
    <!-- Start css3menu.com BODY section -->
        <li class="topfirst"><a href="../Pages/home.html" style="width:190px;">Home</a></li>
        <li class="topmenu"><a href="../Pages/Events.html" style="width:190px;">Events</a></li>
        <li class="topmenu"><a href="../Pages/Mission_Statement.html" style="width:190px;">Mission Statement</a></li>
        <li class="topmenu"><a href="../Pages/Resources.html" style="width:190px;"><span>Resources</span></a>
        <ul>
            <li><a href="../Pages/Advanced_Networking.html"><span>Advanced Networking</span></a>
            <li><a href="../Pages/Qurey_Review.html">Query Review</a></li>
            <li><a href="../Pages/MS_Review_Sessions.html">M.S. Review Sessions</a></li>
            <li><a href="../Pages/1-1 Sessions.html">1-1 Sessions</a></li>
            <li><a href="../Pages/Workshops.html">Workshops</a></li>
            <li><a href="../Pages/final_2013_DAY_SCHEDULE.pdf">Genre Chart</a></li>
            <li><a href="../Pages/Writers_links.html">Writers' Links</a></li>
        </ul></li>
        <li class="topmenu"><a href="#" style="width:190px;"><span>Key Presenters</span></a>
        <ul>
            <li><a href="#"><span>Speakers</span></a>
            <ul>
                <li><a href="../Pages/speakers_page_2013.html">Speakers 2013</a></li>
                <li><a href="../Pages/Speakers_2012.html">Speakers 2012</a></li>
            </ul></li>
            <li><a href="#"><span>Editors</span></a>
            <ul>
                <li><a href="../Pages/Editors_2013.html">Editors 2013</a></li>
                <li><a href="../Pages/editors_2012.html">Editors 2012</a></li>
            </ul></li>
            <li><a href="#"><span>Literary Agents</span></a>
            <ul>
                <li><a href="../Pages/L_agents_2013.html">Literary Agents 2013</a></li>
                <li><a href="../Pages/L_agents_page_2012.html">Literary Agents 2012</a></li>
            </ul></li>
        </ul></li>
        <li class="topmenu"><a href="#" style="width:190px;"><span>Information</span></a>
        <ul>
            <li><a href="../Pages/St_Clements.html">St. Clements</a></li>
            <li><a href="../Pages/Directions.html">Directions</a></li>
            <li><a href="../Pages/Hotel.html">Hotels</a></li>
            <li><a href="../Pages/Menu.html">Menu</a></li>
            <li><a href="../Pages/Unicorn_Photo_Gallery.html">Unicorn Photo Gallery</a></li>
            <li><a href="../Pages/final_2013_DAY_SCHEDULE.pdf">Day Schedule</a></li>
            <li><a href="../Pages/FAQ.html">FAQ</a></li>
            <li><a href="../Pages/Staff.html">Staff</a></li>
            <li><a href="../Pages/Contact.html">Contact</a></li>
        </ul></li>
        <li class="topmenu"><a href="../Pages/Registration.html" style="width:190px;">Registration</a></li>
        <li class="topmenu"><a href="#" style="width:190px;"><span>Acclaim</span></a>
        <ul>
            <li><a href="../Pages/Spotlights.html">Spotlight</a></li>
            <li><a href="../Pages/Testimonials.html">Testimonial</a></li>
            <li><a href="../Pages/Sponsorship.html">Sponsorship</a></li>
        </ul></li>
        <li class="topmenu"><a href="#" style="width:190px;"><span>Classifieds</span></a>
        <ul>
            <li><a href="../Pages/View_Classifieds.html">View Classifieds</a></li>
            <li><a href="../Pages/Place_Classifieds.html">Place Classifieds</a></li>
        </ul></li>
        <li class="toplast"><a href="../Pages/Merchandise.html" style="width:190px;">Merchandise</a></li>
    </ul><p class="_css3m"><a href="http://css3menu.com/">Horizontal Menu Using CSS Css3Menu.com</a></p>
    <!-- End css3menu.com BODY section -->
      </div>
      <!-- TemplateBeginEditable name="main_content_editable" -->
      <div id="main_content">
      <p>Main Content</p>
      </div>
      <!-- TemplateEndEditable --></div>
    <div id="footer">This Page was built webmaster- SKYFALL</div>
    </body>
    </html>
    HERE IS THE STYLE SHEET ATTACHED TO IT
    @charset "utf-8";
    /* CSS Document */
    #container {
        height:auto;
        text-align: left;
        width: 1000px
    #header {
        width:990px;
        height: 250px;
        clear:both;
        font-size:xx-large;
        font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
        color: #C3F;
        margin-top: 5px;
        margin-right: 5px;
        margin-left: 5px;
        background-image: url(Images/header_final.png);
        text-align: left;
    #menubar_left {
        float: left;
        width: 200px;
        margin-top: 5px;
        margin-bottom: 5px;
        margin-left: 5px;
    #main_content {
        float: right;
        width: 780px;
        margin-top: 5px;
        margin-bottom: 5px;
        margin-right: 5px;
        background-image:url(Images/parchment2.jpg);
        font-size: large;
        text-align: left;
        vertical-align: top;
    #footer {
        font-size: x-small;
        clear: both;
        width: 990px;
        margin: 5px;
    .title_mainmenu_content {
        font-family: "MS Serif", "New York", serif;
        font-size: 18px;
        text-decoration: underline;
        vertical-align: top;
    #container #main_content p1 {
        text-align: center;
        font-size: x-large;
    #container #main_content p2 {
        text-align: center;
        color: #F00;
    #container #main_content p span p4 {
        color: #F00;
    .Workshop_title {
        text-align: right;
        font-weight: bold;
    #container #main_content table tr td .title_mainmenu_content .title_mainmenu_content_jan {
    HERE IS MY ATTEMPT TO REDUE IT (STYLESHEET IS INCLUDED IN THE DOCUMENT I WILL MOVE IT LATER)
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Untitled Document</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    <style type="text/css">
    #ancestor_left {
        width: 660px;
        float: left;
    #ancestor_right {
        width: 660px;
        float: right;
    #Master_container {
        width: 2340px;
    #wrapper {
        width: 1000px;
        float: center;
    </style>
    </head>
    <body>
    <div id="Master_container">
      <div id="ancestor_left"><img src="../Images/ancestor_cropped.jpg" width="659" height="1003" alt="ancestor image left" /></div>
      <div id="wrapper">What the heck is wrong with this</div>
      <div id="ancestor_right"><img src="../Images/ancestor_cropped.jpg" width="659" height="1003" alt="ancestor image right" /></div>
    </div>
    </body>
    </html>

  • How can I label data points in a scatter chart with text strings?

    Post Author: Bill B
    CA Forum: Charts and Graphs
    I need to create a Scatter Chart, with a text label for each data point instead of the xy coordinates. A legend will no longer be necessary.Also, I want to draw "cross-hair" lines on both the x and y axes centered on one particular data point.Any ideas?

    Post Author: ebobo
    CA Forum: Charts and Graphs
    Hi
    I have the same problem here, did you find any solutions.
    Here we are ok if the dimension is displayed in the scatter instead of the measurements but the only options i founds was "Show data" and that option displays the values of the xy.
    pls let me know if anybody found any solution for this problem

Maybe you are looking for