void (@NotNull PaintAwarePanel canvas, int indentLevel) { JBLabel label = new JBLabel(GradleBundle.message("gradle.settings.text.vm.options")); canvas.add(label, ExternalSystemUiUtil.getLabelConstraints(indentLevel)); myGradleVmOptionsComponents.add(label); myGradleVmOptionsField = new JBTextField(); canvas.add(myGradleVmOptionsField, ExternalSystemUiUtil.getFillLineConstraints(indentLevel)); myGradleVmOptionsComponents.add(myGradleVmOptionsField); label.setLabelFor(myGradleVmOptionsField); Component glue = Box.createGlue(); canvas.add(glue, ExternalSystemUiUtil.getLabelConstraints(indentLevel)); myGradleVmOptionsComponents.add(glue); HyperlinkLabel fixLabel = new HyperlinkLabel(); fixLabel.setFontSize(UIUtil.FontSize.SMALL); fixLabel.setForeground(UIUtil.getLabelFontColor(UIUtil.FontColor.BRIGHTER)); fixLabel.setIcon(AllIcons.General.BalloonWarning12); label.setVerticalTextPosition(SwingConstants.TOP); GridBag constraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel); constraints.insets.top = 0; canvas.add(fixLabel, constraints); myGradleVmOptionsComponents.add(fixLabel); myGradleVmOptionsField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { boolean showMigration = e.getDocument().getLength() > 0; fixLabel.setHyperlinkText( GradleBundle.message("gradle.settings.text.vm.options.link.tooltip") + " ", showMigration ? GradleBundle.message("gradle.settings.text.vm.options.link.text") : " ", ""); } }); myGradleVmOptionsField.setText(" "); // trigger listener fixLabel.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(@NotNull HyperlinkEvent e) { String jvmArgs = myGradleVmOptionsField.getText().trim(); if (jvmArgs.isEmpty()) return; if (moveVMOptionsToGradleProperties(jvmArgs, myInitialSettings)) { myGradleVmOptionsField.setText(null); myGradleVmOptionsField.getEmptyText().setText(GradleBundle.message("gradle.settings.text.vm.options.empty.text")); } } }); }