newPlacement = new Block();
newPlacement.graphics.beginFill(0xFFFFFF);
newPlacement.graphics.drawRoundRect(0, 0, 25, 25, 9);
newPlacement.graphics.endFill();
newPlacement.graphics.beginFill(0xFFFFFF);
newPlacement.graphics.drawRect(0,0,10,25);
newPlacement.graphics.endFill();
blockHolder.addChild(newPlacement);
这是我在Flash中使用的代码,在舞台上绘制一个方形对象,左边是锯齿状,右边是圆角。任何人都可以帮我弄清楚如何编码这个翻转图像(一个方形对象,左边是圆角,右边是锯齿状)。谢谢!
答案 0 :(得分:3)
您的代码基本上是添加一个圆角矩形,然后在其上面放置一个常规矩形。常规矩形不是那么宽,所以圆角矩形不会被掩盖在右侧。
您需要做的就是将常规矩形放置在右侧15个单位。所以不要这样:
public void addData(){
final DefaultTableModel model = (DefaultTableModel) resultTable.getModel();
new Thread(new Runnable(){
public void run(){
FileInputStream fstream = null;
try {
fstream = new FileInputStream("\\data.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
String line;
while((line = br.readLine()) != null){
final String ln = line;
SwingUtilities.invokeAndWait(new Runnable(){
// run on EDT thread.
public void run(){
model.addRow(new Object[]{ln});
}
});
synchronized(Thread.currentThread()){
Thread.currentThread().wait(2000);// pause for 2 second.
}
}
} catch (FileNotFoundException ex) {
...
} catch (IOException ex) {
....
} finally {
if(fstream!=null){
try{
fstream.close();
}catch (IOException e) {
....
}
}
}
}
}).start();
}
这样做:
newPlacement.graphics.drawRect(0,0,10,25);
但我仍然喜欢这个:
newPlacement.graphics.drawRect(15,0,10,25);
个人偏好。