我想将文本的对齐方式设置为正确.实际上这些字段与货币有关,所以如果它从右边开始,它看起来会很好.
PreparedStatement stmt1 = con.prepareStatement("select sum(tv)as totalsum from mut_det WHERE rm_id = ?");
ResultSet rs1;
String rm1 = tf_rm_id.getText().trim();
stmt1.setInt(1, Integer.parseInt(rm1));
rs1 = stmt1.executeQuery();
while (rs1.next()) {
String text = rs1.getString("totalsum");
tf_rsfig.setText(text);
}
Run Code Online (Sandbox Code Playgroud) 我正在将时间计算从自我实现的代码转换为Java 8 Time API。
我需要一个java.time.Year或java.time.Month类的开始和结束时间(以毫秒为单位),我计划稍后在另一层中使用JFreeChart。
我需要一个像功能getFirstMillisecond()及getLastMilliSecond()从org.jfree.data.time.RegularTimePeriod类的JFreeChart的。
我已经实现了类似以下的代码:
public static long getStartTimeInMillis(java.time.Year year, java.time.Month month) {
if (year != null && month != null) {
return LocalDate.of(year.getValue(), month, 1).with(TemporalAdjusters.firstDayOfMonth()).
atStartOfDay().atZone(TimeZone.getDefault().toZoneId()).toInstant().toEpochMilli();
} else if (year != null) {
return LocalDate.of(year.getValue(), java.time.Month.JANUARY, 1).with(TemporalAdjusters.firstDayOfMonth()).
atStartOfDay().atZone(TimeZone.getDefault().toZoneId()).toInstant().toEpochMilli();
}
return 0;
}
public static long getEndTimeInMillis(java.time.Year year, java.time.Month month) {
if (year != null && month != null) {
return LocalDate.of(year.getValue(), month, 1).with(TemporalAdjusters.lastDayOfMonth()).
atTime(OffsetTime.MAX).toLocalDateTime().atZone(TimeZone.getDefault().toZoneId()).toInstant().toEpochMilli();
} else if …Run Code Online (Sandbox Code Playgroud)