这是一个函数:
/**
* Creates an instance of a JLabel with the given arguments
* @param text The text to be displayed on the Label
* @param font The font of the label
* @param bold set to true if you want the label's text to be bold
* @param fontSize The size of the font to be rendered
* @param alignment An alignment (E.g. CENTER_ALIGNMENT)
* @param verticleAlignment an optional argument to allow one to choose the Y alignment
* **/
public JLabel createLabel(String text, String font, boolean bold, int fontSize, float alignment, float...verticleAlignment){
JLabel label = new JLabel(text);
label.setFont(new Font(font, bold ? Font.BOLD : Font.PLAIN, fontSize));
label.setAlignmentX(alignment);
if(verticleAlignment.length > 0){
label.setAlignmentY(verticleAlignment[0]);
}
return label;
}
出于某种原因,无论我在 varArg verticleAlignment 中输入什么,它实际上都不适用?
add(createLabel("ChatBytes™ - Do not steal.", "Arial", false, 12, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT));
谁能看到它会忽略我函数的 setYAlignment 部分的原因?