Java Code Examples for javax.swing.border.TitledBorder#setTitleFont()

The following examples show how to use javax.swing.border.TitledBorder#setTitleFont() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIRes.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
public static void addStyle(JTextField textField, String labelName, boolean bottom) {
	textField.setHorizontalAlignment(SwingConstants.RIGHT);
	Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
	TitledBorder titled = BorderFactory.createTitledBorder(line, labelName);
	titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13));
	titled.setTitleColor(fontColorTitle);
	Border empty = null;
	if (bottom) {
		empty = new EmptyBorder(5, 8, 5, 8);
	} else {
		empty = new EmptyBorder(5, 8, 0, 8);
	}
	CompoundBorder border = new CompoundBorder(titled, empty);
	textField.setBorder(border);
	textField.setForeground(fontColor);
	textField.setFont(GraphicsUtils.getFont("Monospaced", 0, 13));
}
 
Example 2
Source File: Test7022041.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 3
Source File: Test7022041.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 4
Source File: Test7022041.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 5
Source File: LoadGenProfilingPoint.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                String urlString = url.toString();

                if (START_LOCATION_URLMASK.equals(urlString)) {
                    Utils.openLocation(LoadGenProfilingPoint.this.getStartLocation());
                } else if (LoadGenProfilingPoint.this.usesEndLocation()) {
                    Utils.openLocation(LoadGenProfilingPoint.this.getEndLocation());
                }
            }
        };

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea();

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.LoadGenProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
Example 6
Source File: Test7022041.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 7
Source File: PDVMainClass.java    From PDV with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Update spectrum
 * @param mSnSpectrum MSN spectrm
 * @param spectrumMatch Spectrum match
 */
private void updateSpectrum(MSnSpectrum mSnSpectrum, SpectrumMatch spectrumMatch) {

    String modSequence;
    SpectrumIdentificationAssumption spectrumIdentificationAssumption;

    if (spectrumMatch.getBestPeptideAssumption() != null) {
        spectrumIdentificationAssumption = spectrumMatch.getBestPeptideAssumption();
        modSequence = spectrumMatch.getBestPeptideAssumption().getPeptide().getTaggedModifiedSequence(searchParameters.getPtmSettings(), false, false, false, false);

    } else if (spectrumMatch.getBestTagAssumption() != null) {
        spectrumIdentificationAssumption = spectrumMatch.getBestTagAssumption();
        modSequence = spectrumMatch.getBestTagAssumption().getTag().getTaggedModifiedSequence(searchParameters.getPtmSettings(), false, false, true, false);
    } else {
        throw new IllegalArgumentException("No best assumption found for spectrum " + ".");
    }

    TitledBorder titledBorder = BorderFactory.createTitledBorder(modSequence + " \t ");

    titledBorder.setTitleFont(new Font("Console", Font.PLAIN, 12));

    spectrumShowJPanel.setBorder(titledBorder);

    spectrumMainPanel.updateSpectrum(spectrumIdentificationAssumption, mSnSpectrum, String.valueOf(selectedPsmKey));

    spectrumShowJPanel.revalidate();
    spectrumShowJPanel.repaint();
}
 
Example 8
Source File: Test7022041.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 9
Source File: TaskReloadConfigPanel.java    From gameserver with Apache License 2.0 5 votes vote down vote up
public void init() {
	JXPanel settingPanel = new JXPanel();
	TitledBorder border = BorderFactory.createTitledBorder(
			BorderFactory.createEtchedBorder(), "服务器设定");
	border.setTitleFont(MainFrame.BIG_FONT);
	settingPanel.setBorder(border);
	
	this.okButton.setActionCommand(ActionName.OK.name());
	this.okButton.addActionListener(this);
	
	settingPanel.setLayout(new MigLayout("wrap 4, gap 10px, alignx center", ""));
	
	settingPanel.add(this.lblGameServer, "sg lb");
	settingPanel.add(this.gameServerField, "sg fd, growx, pushx");
	settingPanel.add(this.lblGamePort,  "sg lb");
	settingPanel.add(this.gameServerPort, "sg fd, growx, pushx");
	
	JXPanel configPanel = new JXPanel();
	TitledBorder backupBorder =  BorderFactory.createTitledBorder("配置文件");
	backupBorder.setTitleFont(MainFrame.BIG_FONT);
	configPanel.setBorder(backupBorder);
	configPanel.setLayout(new MigLayout("wrap 4, align center"));
	JXPanel collPanel = new JXPanel();
	collPanel.setLayout(new MigLayout("wrap 4, align center"));
	collPanel.setBorder(BorderFactory.createEtchedBorder());
	for ( int i=0; i<CONFIG_NAMES.length; i++ ) {
		String collection = CONFIG_NAMES[i];
		backupCollections[i] = new JCheckBox(collection);
		collPanel.add(backupCollections[i], "sg checkbox");
	}
	configPanel.add(collPanel, "align center, width 100%");
	configPanel.add(this.okButton, "newline, span, split 2, alignx center, aligny bottom");
	
	this.setLayout(new MigLayout("wrap 1"));
	this.add(settingPanel, "width 100%");
	this.add(configPanel,  "width 100%");
}
 
Example 10
Source File: ModSelectWindow.java    From ModTheSpire with MIT License 5 votes vote down vote up
private JLabel makeInfoLabelField(String title, String value)
{
    JLabel label = new JLabel(value);

    TitledBorder border = BorderFactory.createTitledBorder(title);
    border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD));
    label.setFont(label.getFont().deriveFont(Font.PLAIN));
    label.setBorder(BorderFactory.createCompoundBorder(
        border,
        BorderFactory.createEmptyBorder(5, 5, 5, 5)
    ));

    return label;
}
 
Example 11
Source File: WizardManager.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void updateScrollPaneBorder(JPanel panel) {
	if (panel == null) {
		return;
	}

	scrollPane.setBackground(panel.getBackground());

	if (scrollPane.getVerticalScrollBar().isShowing()) {
		TitledBorder titledBorder =
			new TitledBorder(BorderFactory.createEmptyBorder(), "(scroll for more options)");

		Font font = titledBorder.getTitleFont();
		if (font == null) {
			// workaround for bug on Java 7
			font = titleLabel.getFont();
		}

		titledBorder.setTitleFont(font.deriveFont(10f));
		titledBorder.setTitleColor(Color.BLUE);
		titledBorder.setTitlePosition(TitledBorder.BOTTOM);
		titledBorder.setTitleJustification(TitledBorder.TRAILING);

		scrollPane.setBorder(titledBorder);
	}
	else {
		scrollPane.setBorder(BorderFactory.createEmptyBorder());
	}
}
 
Example 12
Source File: Test7022041.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
  * Check behaviour of method TitledBorder.getTitleFont()
  */
private static void checkTitleFont() {
    TitledBorder titledBorder = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
    Font defaultFont = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
    Font titledBorderFont = titledBorder.getTitleFont();

    // check default configuration
    if (defaultFont == null) {
        if (titledBorderFont == null) {
            return;
        }
        else {
            throw new RuntimeException("TitledBorder default font should be null");
        }
    }
    if (!defaultFont.equals(titledBorderFont)) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }

    // title font is explicitly specified
    Font font = new Font("Dialog", Font.PLAIN, 10);
    titledBorder.setTitleFont(font);
    if (!font.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("TitledBorder font should be " + font.toString());
    }

    // title Font is unspecified
    titledBorder.setTitleFont(null);
    if (!defaultFont.equals(titledBorder.getTitleFont())) {
        throw new RuntimeException("L&F default font " + defaultFont.toString()
                                 + " differs from TitledBorder font " + titledBorderFont.toString());
    }
}
 
Example 13
Source File: DisplayModule.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Create a new module and set the title.  Initialize the name and value arrays.
 * Create the GUI
 * 
 * @param title
 * @param size
 */
public DisplayModule(FoxSpacecraft fox2, String title, int size, int modType) {
	fox = fox2;
	foxId = fox.foxId;
	this.size = size;
	this.title = title;
	TitledBorder border = new TitledBorder(null, title, TitledBorder.LEADING, TitledBorder.TOP, null, null);
	scale = (double)(Config.displayModuleFontSize)/(double)(DEFAULT_FONT_SIZE);	
	//Log.println("SCALE: " + scale + " font:" +Config.displayModuleFontSize + " def: " + DEFAULT_FONT_SIZE);
	setDefaultSizes();
	moduleType = modType;
			
	if (moduleType == DISPLAY_HERCI || moduleType == DISPLAY_HERCI_HK || moduleType == DISPLAY_HERCI_MICRO_PKT) {
		border.setTitleFont(new Font("SansSerif", Font.BOLD, (int)(Config.displayModuleFontSize * 12/11)));
		border.setTitleColor(herciFontColor);
	} else if (moduleType == DISPLAY_MEASURES) {
		border.setTitleFont(new Font("SansSerif", Font.BOLD, (int)(Config.displayModuleFontSize * 12/10)));
		border.setTitleColor(vulcanFontColor);
		minValue = new JButton[size];
	} else if (moduleType >= DISPLAY_WOD) {
		border.setTitleFont(new Font("SansSerif", Font.BOLD, (int)(Config.displayModuleFontSize * 12/10)));
		border.setTitleColor(wodFontColor);
		minValue = new JButton[size];
	} else if (moduleType >= DISPLAY_VULCAN) {
		border.setTitleFont(new Font("SansSerif", Font.BOLD, (int)(Config.displayModuleFontSize * 12/10)));
		border.setTitleColor(vulcanFontColor);
	} else {
		border.setTitleFont(new Font("SansSerif", Font.BOLD, (int)(Config.displayModuleFontSize * 12/11)));	
		border.setTitleColor(Color.BLUE);
		maxValue = new JLabel[size];
		minValue = new JLabel[size];

	}
	this.setBorder(border);
	
	fieldName = new String[size]; 
	rtValue = new JLabel[size];
	label = new JLabel[size];
	row = new JPanel[size];
	graph = new GraphFrame[GraphFrame.MAX_PLOT_TYPES][size];
	display = new int[size];
	initGui();
	
}
 
Example 14
Source File: SinglePeptideDisplay.java    From PDV with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Update spectrum
 */
private void updateSpectrum(){

    TitledBorder titledBorder = BorderFactory.createTitledBorder(peptideAssumption.getPeptide().getTaggedModifiedSequence(searchParameters.getPtmSettings(), false, false, false, false) + " \t ");
    titledBorder.setTitleFont(new Font("Console", Font.PLAIN, 12));

    spectrumShowJPanel.setBorder(titledBorder);

    SpectrumMatch spectrumMatch = new SpectrumMatch();

    spectrumMatch.setBestPeptideAssumption(peptideAssumption);

    spectrumMainPanel.updateSpectrum(spectrumMatch.getBestPeptideAssumption(), currentSpectrum, "1");

    spectrumShowJPanel.revalidate();
    spectrumShowJPanel.repaint();
}
 
Example 15
Source File: GUIOptionPrivateDNS.java    From PacketProxy with Apache License 2.0 4 votes vote down vote up
private JPanel createPanel(JCheckBox checkBox, JTextField text) throws Exception {
	auto = new JRadioButton(I18nString.get("Auto (Replace resolved IP with local IP of suitable NIC automatically)"), true);
	auto.setMinimumSize(new Dimension(Short.MAX_VALUE, auto.getMaximumSize().height));
	auto.addActionListener(this::radioButtonChangeHandler);
	manual = new JRadioButton(I18nString.get("Manual"), false);
	manual.addActionListener(this::radioButtonChangeHandler);

	ButtonGroup rewriteGroup = new ButtonGroup();
	rewriteGroup.add(auto);
	rewriteGroup.add(manual);

	JPanel manualPanel = new JPanel();
	manualPanel.setBackground(Color.WHITE);
	manualPanel.setLayout(new BoxLayout(manualPanel, BoxLayout.X_AXIS));
	manualPanel.add(manual);
	manualPanel.add(text);

	TitledBorder rewriteRuleBorder = new TitledBorder(I18nString.get("Rewrite Rule"));
	LineBorder inborder = new LineBorder(Color.BLACK, 1);
	rewriteRuleBorder.setBorder(inborder);
	rewriteRuleBorder.setTitleFont(FontManager.getInstance().getUIFont());
	rewriteRuleBorder.setTitleJustification(TitledBorder.LEFT);
	rewriteRuleBorder.setTitlePosition(TitledBorder.TOP);

	JPanel rewriteRule = new JPanel();
	rewriteRule.setLayout(new BoxLayout(rewriteRule, BoxLayout.Y_AXIS));
	rewriteRule.setBackground(Color.WHITE);
	rewriteRule.setBorder(rewriteRuleBorder);
	rewriteRule.add(auto);
	rewriteRule.add(manualPanel);
	rewriteRule.setMaximumSize(new Dimension(rewriteRule.getPreferredSize().width, rewriteRule.getMinimumSize().height));

	JPanel panel = new JPanel();
	panel.setBackground(Color.WHITE);
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	panel.add(checkBox);
	panel.add(rewriteRule);
	panel.setAlignmentX(Component.LEFT_ALIGNMENT);

	return panel;
}
 
Example 16
Source File: JPanelFactory.java    From WorldGrower with GNU General Public License v3.0 4 votes vote down vote up
private static TitledBorder createBorder(String title) {
	TitledBorder border = BorderFactory.createTitledBorder(title);
	border.setTitleColor(ColorPalette.FOREGROUND_COLOR);
	border.setTitleFont(Fonts.FONT);
	return border;
}
 
Example 17
Source File: TakeSnapshotProfilingPoint.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                Utils.openLocation(TakeSnapshotProfilingPoint.this.getLocation());
            }
        };

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                File resolvedFile = null;

                try {
                    resolvedFile = new File(url.toURI());
                } catch (URISyntaxException ex) {
                    ex.printStackTrace();
                }

                final File snapshotFile = resolvedFile;

                if ((snapshotFile != null) && snapshotFile.exists()) {
                    String type = TakeSnapshotProfilingPoint.this.getSnapshotType();
                    if (type.equals(TYPE_PROFDATA_KEY) || type.equals(TYPE_HEAPDUMP_KEY)) {
                        ResultsManager.getDefault().openSnapshot(snapshotFile);
                    }
                } else {
                    ProfilerDialogs.displayWarning(
                            Bundle.TakeSnapshotProfilingPoint_SnapshotNotAvailableMsg());
                }
            }
        };

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.TakeSnapshotProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
Example 18
Source File: FlowFilterPopup.java    From burp-flow with MIT License 4 votes vote down vote up
/**
 * Creates new form FlowTablePane
 */
public FlowFilterPopup() {
    initComponents();
    TitledBorder flowFilterByReqTypeBorder = (TitledBorder) getFlowFilterByReqType().getBorder();
    flowFilterByReqTypeBorder.setTitleFont(flowFilterByReqTypeBorder.getTitleFont().deriveFont(Font.PLAIN));

    TitledBorder flowFilterBySearchBorder = (TitledBorder) getFlowFilterBySearch().getBorder();
    flowFilterBySearchBorder.setTitleFont(flowFilterBySearchBorder.getTitleFont().deriveFont(Font.PLAIN));

    TitledBorder flowFilterBySourceBorder = (TitledBorder) getFlowFilterBySource().getBorder();
    flowFilterBySourceBorder.setTitleFont(flowFilterBySourceBorder.getTitleFont().deriveFont(Font.PLAIN));

    TitledBorder flowFilterCaptureBySourceBorder = (TitledBorder) getFlowFilterCaptureBySource().getBorder();
    flowFilterCaptureBySourceBorder.setTitleFont(flowFilterCaptureBySourceBorder.getTitleFont().deriveFont(Font.PLAIN));

    IBurpExtenderCallbacks callbacks = FlowExtension.getCallbacks();
    callbacks.customizeUiComponent(FlowFilterCaptureSourceExtender);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceExtenderOnly);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceIntruder);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceIntruderOnly);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceTarget);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceTargetOnly);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceProxy);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceProxyOnly);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceRepeater);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceRepeaterOnly);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceScanner);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceScannerOnly);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceSpider);
    callbacks.customizeUiComponent(FlowFilterCaptureSourceSpiderOnly);
    callbacks.customizeUiComponent(FlowFilterInscope);
    callbacks.customizeUiComponent(FlowFilterOutofscope);
    callbacks.customizeUiComponent(FlowFilterParametrized);
    callbacks.customizeUiComponent(FlowFilterSearchCaseSensitive);
    callbacks.customizeUiComponent(FlowFilterSearchField);
    callbacks.customizeUiComponent(FlowFilterSearchNegative);
    callbacks.customizeUiComponent(FlowFilterSearchRegex);
    callbacks.customizeUiComponent(FlowFilterSearchRequest);
    callbacks.customizeUiComponent(FlowFilterSearchResponse);
    callbacks.customizeUiComponent(FlowFilterSourceExtender);
    callbacks.customizeUiComponent(FlowFilterSourceExtenderOnly);
    callbacks.customizeUiComponent(FlowFilterSourceIntruder);
    callbacks.customizeUiComponent(FlowFilterSourceIntruderOnly);
    callbacks.customizeUiComponent(FlowFilterSourceTarget);
    callbacks.customizeUiComponent(FlowFilterSourceTargetOnly);
    callbacks.customizeUiComponent(FlowFilterSourceProxy);
    callbacks.customizeUiComponent(FlowFilterSourceProxyOnly);
    callbacks.customizeUiComponent(FlowFilterSourceRepeater);
    callbacks.customizeUiComponent(FlowFilterSourceRepeaterOnly);
    callbacks.customizeUiComponent(FlowFilterSourceScanner);
    callbacks.customizeUiComponent(FlowFilterSourceScannerOnly);
    callbacks.customizeUiComponent(FlowFilterSourceSpider);
    callbacks.customizeUiComponent(FlowFilterSourceSpiderOnly);
}
 
Example 19
Source File: TriggeredTakeSnapshotProfilingPoint.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
    setLayout(new BorderLayout());

    JPanel contentsPanel = new JPanel(new BorderLayout());
    contentsPanel.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.setOpaque(true);
    contentsPanel.setBorder(BorderFactory.createMatteBorder(0, 15, 15, 15, UIUtils.getProfilerResultsBackground()));

    headerArea = new HTMLTextArea();

    JScrollPane headerAreaScrollPane = new JScrollPane(headerArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                       JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    headerAreaScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 15, 0, UIUtils.getProfilerResultsBackground()));
    headerAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    contentsPanel.add(headerAreaScrollPane, BorderLayout.NORTH);

    dataArea = new HTMLTextArea() {
            protected void showURL(URL url) {
                File resolvedFile = null;

                try {
                    resolvedFile = new File(url.toURI());
                } catch (URISyntaxException ex) {
                    ex.printStackTrace();
                }

                final File snapshotFile = resolvedFile;

                if ((snapshotFile != null) && snapshotFile.exists()) {
                    String type = TriggeredTakeSnapshotProfilingPoint.this.getSnapshotType();
                    if (type.equals(TYPE_PROFDATA_KEY) || type.equals(TYPE_HEAPDUMP_KEY)) {
                        ResultsManager.getDefault().openSnapshot(snapshotFile);
                    }
                } else {
                    ProfilerDialogs.displayWarning(
                            Bundle.TriggeredTakeSnapshotProfilingPoint_SnapshotNotAvailableMsg());
                }
            }
        };

    JScrollPane dataAreaScrollPane = new JScrollPane(dataArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TitledBorder tb = new TitledBorder(Bundle.TriggeredTakeSnapshotProfilingPoint_DataString());
    tb.setTitleFont(Utils.getTitledBorderFont(tb).deriveFont(Font.BOLD));
    tb.setTitleColor(javax.swing.UIManager.getColor("Label.foreground")); // NOI18N
    dataAreaScrollPane.setBorder(tb);
    dataAreaScrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
    dataAreaScrollPane.setBackground(UIUtils.getProfilerResultsBackground());
    contentsPanel.add(dataAreaScrollPane, BorderLayout.CENTER);

    add(contentsPanel, BorderLayout.CENTER);
}
 
Example 20
Source File: MiscTools.java    From megabasterd with GNU General Public License v3.0 3 votes vote down vote up
public static void updateTitledBorderFont(final TitledBorder border, final Font font, final float zoom_factor) {

        Font old_title_font = border.getTitleFont();

        Font new_title_font = font.deriveFont(old_title_font.getStyle(), Math.round(old_title_font.getSize() * zoom_factor));

        border.setTitleFont(new_title_font);
    }