#navi(contents-page-name): No such page: ST

Terai Atsuhiro 2021-10-27 (水) 00:02:51

http://terai.s55.xrea.com/swing/dashedline/screenshot.png

label = new JLabel() {
  BasicStroke dashed2 = new BasicStroke();
  public void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D)g;
    super.paintComponent(g2);
    if(flag) dashed2 = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
                       BasicStroke.JOIN_MITER, 10.0f, getDashList(), 0.0f);
    flag = false;
    g2.setStroke(dashed2);
    g2.drawLine(5, label.getHeight()/2, label.getWidth()-10,
                label.getHeight()/2);
  }
};