Границы таблицы - Java
Формулировка задачи:
Есть таблица с прозрачным фоном, но рамка не у всей таблицы, точнее нет верхней и левой линии границы, а хотелось бы что бы они были, это решаемо ?
jTable.setRowHeight(30);
jTable.setGridColor(Color.white);
jTable.setBounds(5, 90, 210, 210);
jTable.setSelectionBackground(new Color(0,0,0,0));
jTable.setBackground(new Color(0,0,0,70));Решение задачи: «Границы таблицы»
textual
Листинг программы
private void panel_calendar()
{
String day_week[] = {"Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"};
String year_month[] = {"Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"};
int hw = 30;
int week_day, full_day, day_date, month_date, year_date;
int days = 0;
int start_day = 0;
JPanel container = new JPanel();
container.setLayout(new BorderLayout());
container.setBounds(4, 90, hw*day_week.length, hw*day_week.length + hw);
container.setBackground(new Color(0,0,0,70));
container.setLayout(null);
Calendar calendar = Calendar.getInstance();
day_date = calendar.get(Calendar.DAY_OF_MONTH);
month_date = calendar.get(Calendar.MONTH);
year_date = calendar.get(Calendar.YEAR);
full_day = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(year_date, month_date, 1);
week_day = calendar.get(Calendar.DAY_OF_WEEK);
JLabel jlabel = new JLabel(year_month[month_date] + " " + year_date, SwingConstants.CENTER);
jlabel.setForeground(Color.white);
jlabel.setBounds(0, 0, day_week.length * hw, hw);
container.add(jlabel);
for (int i = 0; i < day_week.length; i++)
{
JLabel jlabels = new JLabel(day_week[i], SwingConstants.CENTER);
jlabels.setForeground(Color.white);
jlabels.setBounds(hw * i, hw, hw, hw);
container.add(jlabels);
}
for (int j = 0; j < 6; j++)
{
if(j == 0)
{
start_day = week_day-2;
}
else
{
start_day = 0;
}
for (int f = start_day; f < 7; f++)
{
if (days < full_day)
{
days++;
}
else
{
break;
}
JLabel jlabel_day = new JLabel("" + days, SwingConstants.CENTER);
jlabel_day.setForeground(Color.white);
if (days == day_date)
{
jlabel_day.setBorder(BorderFactory.createLineBorder(Color.WHITE, 3));
}
jlabel_day.setBounds(hw * f, (hw * 2) + (hw * j), hw, hw);
container.add(jlabel_day);
}
}
window.add(container);
}