我有import static org.mockito.Mockito.when;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
class Employee {
public void getAddress() {
Address add = new Address();
String a = add.addAddress();
System.out.println(a);
}
}
class Address {
public String addAddress() {
return "Emp Address";
}
}
@RunWith(PowerMockRunner.class)
@PrepareForTest(Employee.class)
public class MockitoTest {
@Mock
Address add;
@Test
public void testEmployee() throws Exception {
when(add.addAddress()).thenReturn("mocked address");
PowerMockito.whenNew(Address.class).withNoArguments().thenReturn(add);
Employee e = new Employee();
e.getAddress();
}
}
,并定期使用JFrame
在屏幕上绘制PNG图像。图像按照鼠标指针旋转。
当图像旋转时,它的质量非常糟糕(在照片中)。
PNG是20x10像素。
怎么办?
paintComponent
答案 0 :(得分:0)
不确定它会有所帮助,但您可以尝试更改某些图形属性。例如:
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);