0N/A/*
1472N/A * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/Apackage sun.jvm.hotspot.ui;
0N/A
0N/Aimport java.awt.*;
0N/Aimport javax.swing.*;
0N/Aimport javax.swing.event.*;
0N/A
0N/Aimport sun.jvm.hotspot.runtime.*;
0N/Aimport sun.jvm.hotspot.ui.classbrowser.*;
0N/A
0N/A/** Provides Java stack trace of a Java Thread */
0N/A
0N/Apublic class JavaStackTracePanel extends JPanel {
0N/A private JSplitPane splitPane;
0N/A private SAEditorPane stackTraceEditor;
0N/A private SAEditorPane contentEditor;
0N/A private HTMLGenerator htmlGen = new HTMLGenerator();
0N/A
0N/A public JavaStackTracePanel() {
0N/A initUI();
0N/A }
0N/A
0N/A private void initUI() {
0N/A setLayout(new BorderLayout());
0N/A HyperlinkListener hyperListener = new HyperlinkListener() {
0N/A public void hyperlinkUpdate(HyperlinkEvent e) {
0N/A if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
0N/A setContentText(htmlGen.genHTMLForHyperlink(e.getDescription()));
0N/A }
0N/A }
0N/A };
0N/A
0N/A stackTraceEditor = new SAEditorPane();
0N/A stackTraceEditor.addHyperlinkListener(hyperListener);
0N/A
0N/A contentEditor = new SAEditorPane();
0N/A contentEditor.addHyperlinkListener(hyperListener);
0N/A
0N/A JPanel topPanel = new JPanel();
0N/A topPanel.setLayout(new BorderLayout());
0N/A topPanel.add(new JScrollPane(stackTraceEditor), BorderLayout.CENTER);
0N/A
0N/A JPanel bottomPanel = new JPanel();
0N/A bottomPanel.setLayout(new BorderLayout());
0N/A bottomPanel.add(new JScrollPane(contentEditor), BorderLayout.CENTER);
0N/A
0N/A splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel);
0N/A splitPane.setDividerLocation(0.4);
0N/A
0N/A setLayout(new BorderLayout());
0N/A add(splitPane, BorderLayout.CENTER);
0N/A }
0N/A
0N/A public void setJavaThread(final JavaThread thread) {
0N/A setStackTraceText(htmlGen.genHTMLForJavaStackTrace(thread));
0N/A }
0N/A
0N/A private void setStackTraceText(String text) {
0N/A stackTraceEditor.setText(text);
0N/A }
0N/A
0N/A private void setContentText(String text) {
0N/A contentEditor.setText(text);
0N/A }
0N/A}