我使用圆形按钮,我想在里面有一个图像。问题是图像位于中心而不是左侧甚至已经调用
loadButton.setAlignment(Pos.BASELINE_LEFT);
我得到的是上面的按钮,我需要的是下面的按钮。你知道在圆角下显示png的方法吗?
typedef struct
{
unsigned char data[3];
} rgb;
rgb LUTYUVTORGB[256][256][256];
非常感谢!
答案 0 :(得分:0)
而不是:
import java.util.Scanner;
public class A3Question1
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
boolean loop1 = false;
boolean loop2 = false;
boolean loop3 = false;
int numNouns = 0, numAdjectives = 0;
String[] nouns = new String[numNouns];
String[] adjectives = new String[numAdjectives];
System.out.println("-----------------------------------------");
System.out.println(" Let's write a poem! ");
System.out.println("-----------------------------------------");
System.out.println();
while (!loop1)
{
System.out.print("How many nouns? (min 3): ");
numNouns = keyboard.nextInt();
if (numNouns < 3)
{
continue;
}
else
{
loop1 = true;
}
System.out.println("Enter " + numNouns + " nouns: ");
nouns = new String[numNouns];
for (int i = 0; i < numNouns; i++)
{
nouns[i] = keyboard.next();
}
}
while (!loop2)
{
System.out.print("How many adjectives? (min 3): ");
numAdjectives = keyboard.nextInt();
if (numAdjectives < 3)
{
continue;
}
else
{
loop2 = true;
}
System.out.println("Enter " + numAdjectives + " adjectives: ");
adjectives = new String[numAdjectives];
for (int j = 0; j < numAdjectives; j++)
{
adjectives[j] = keyboard.next();
}
}
while (!loop3)
{
System.out.println("\n-----------------------------------");
System.out.println(" Here is my Java Poem! ");
System.out.println(" **LOOK AROUND** ");
System.out.println("-----------------------------------");
System.out.println();
boolean[] noDuplicate1 = new boolean[numNouns];
boolean[] noDuplicate2 = new boolean[numAdjectives];
for(int i = 0; i < 1000; i++)
{
int num1 = (int) (Math.random() * numNouns);
int num2 = (int) (Math.random() * numAdjectives);
if (noDuplicate1[num1] == false && noDuplicate2[num2] == false)
{
for (int j = 0; j < i; j++)
{
System.out.print("\t");
}
System.out.println(adjectives[num2] + nouns[num1]);
noDuplicate1[num1] = true;
noDuplicate2[num2] = true;
}
}
System.out.print("\nAnother poem? (y/n): ");
String again = keyboard.next();
if (again.charAt(0) == 'y' || again.charAt(0) == 'Y')
{
continue;
}
else
{
loop3 = true;
}
}
System.out.println("Thank you for using the POEM GENERATOR! Have a good day!");
keyboard.close();
}
使用:
loadButton.setContentDisplay(ContentDisplay.LEFT);