/** * ハイパーリンクの設定 * * @param sheet シート * @param nRow 対象行番号 * @param nColumn 対象列番号 * @param value ハイパーリンクテキスト * @param url ハイパーリンク先URL */ public static void setHyperLink( XSSFSheet sheet, int nRow, int nColumn, String value, String url) { assert sheet != null; XSSFWorkbook workbook = sheet.getWorkbook(); CreationHelper helper = workbook.getCreationHelper(); Hyperlink hyperlink = helper.createHyperlink(Hyperlink.LINK_URL); hyperlink.setAddress(url); XSSFRow row = getRowAnyway(sheet, nRow); XSSFCell cell = getCellAnyway(row, nColumn); cell.setCellValue(value); cell.setHyperlink(hyperlink); // ハイパーリンクテキストの装飾 XSSFFont font = workbook.createFont(); XSSFCellStyle style = workbook.createCellStyle(); // font.setColor(new XSSFColor(new Color(0, 0, 255))); font.setUnderline(XSSFFont.U_SINGLE); style.setFont(font); cell.setCellStyle(style); }
public void reset() { Road road = edgenode.getRoad(); if (road != null) { roadLink.setText(road.getName()); roadLink.setEnabled(true); nodeLink.setText(road.getOtherNode(edgenode).getName()); nodeLink.setEnabled(true); } else { roadLink.setText("null"); roadLink.setEnabled(false); nodeLink.setText("null"); nodeLink.setEnabled(false); } }
public EditEdgeNodePanel(ConfigDialog cd, EdgeNode e) { super(cd); Label clab = new Label("Connects:"); clab.setBounds(0, 0, 100, 20); add(clab); roadLink = new Hyperlink(); roadLink.addActionListener(this); roadLink.setBounds(100, 0, 100, 20); add(roadLink); Label wlab = new Label("With:"); wlab.setBounds(0, 20, 100, 20); add(wlab); nodeLink = new Hyperlink(); nodeLink.addActionListener(this); nodeLink.setBounds(100, 20, 100, 20); add(nodeLink); setEdgeNode(e); }