mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-13 05:46:59 -04:00
Added searching log texts. Closes #69
This commit is contained in:
parent
38eff7e59c
commit
4ecdefc14e
@ -34,7 +34,7 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<Component id="btnContact" min="-2" max="-2" attributes="0"/>
|
<Component id="btnContact" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="183" max="32767" attributes="0"/>
|
<EmptySpace pref="144" max="32767" attributes="0"/>
|
||||||
<Component id="btnTerminateGame" min="-2" max="-2" attributes="0"/>
|
<Component id="btnTerminateGame" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="btnCopy" min="-2" max="-2" attributes="0"/>
|
<Component id="btnCopy" min="-2" max="-2" attributes="0"/>
|
||||||
@ -45,10 +45,14 @@
|
|||||||
</Group>
|
</Group>
|
||||||
<Component id="lblCrash" alignment="0" max="32767" attributes="0"/>
|
<Component id="lblCrash" alignment="0" max="32767" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="lblShowLines" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="cboShowLines" min="-2" max="-2" attributes="0"/>
|
<Component id="cboShowLines" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="lblSearch" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="txtSearch" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="btnFatal" min="-2" max="-2" attributes="0"/>
|
<Component id="btnFatal" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="btnError" min="-2" max="-2" attributes="0"/>
|
<Component id="btnError" min="-2" max="-2" attributes="0"/>
|
||||||
@ -70,13 +74,15 @@
|
|||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="lblShowLines" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="cboShowLines" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="cboShowLines" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="btnDebug" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="btnDebug" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="btnInfo" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="btnInfo" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="btnWarn" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="btnWarn" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="btnError" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="btnError" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="btnFatal" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="btnFatal" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="txtSearch" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="lblSearch" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="lblCrash" min="-2" max="-2" attributes="0"/>
|
<Component id="lblCrash" min="-2" max="-2" attributes="0"/>
|
||||||
@ -161,15 +167,20 @@
|
|||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JTextPane" name="txtLog">
|
<Component class="javax.swing.JTextPane" name="txtLog">
|
||||||
|
<Properties>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
</Properties>
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JLineWrapTextPane()"/>
|
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JLineWrapTextPane()"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
<Component class="javax.swing.JLabel" name="lblShowLines">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="显示行数"/>
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/jackhuang/hmcl/lang/I18N.properties" key="logwindow.show_lines" replaceFormat="C.i18n("{key}")"/>
|
||||||
|
</Property>
|
||||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
@ -192,27 +203,42 @@
|
|||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="btnDebug">
|
<Component class="javax.swing.JToggleButton" name="btnDebug">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="debugs"/>
|
<Property name="text" type="java.lang.String" value="0 debug"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="btnInfo">
|
<Component class="javax.swing.JToggleButton" name="btnInfo">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="infos"/>
|
<Property name="text" type="java.lang.String" value="0 info"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="btnWarn">
|
<Component class="javax.swing.JToggleButton" name="btnWarn">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="warns"/>
|
<Property name="text" type="java.lang.String" value="0 warn"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JButton" name="btnError">
|
<Component class="javax.swing.JButton" name="btnError">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="errors"/>
|
<Property name="text" type="java.lang.String" value="0 error"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JButton" name="btnFatal">
|
<Component class="javax.swing.JButton" name="btnFatal">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="fatals"/>
|
<Property name="text" type="java.lang.String" value="0 fatal"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="txtSearch">
|
||||||
|
<Properties>
|
||||||
|
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtSearchActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="lblSearch">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/jackhuang/hmcl/lang/I18N.properties" key="logwindow.search" replaceFormat="C.i18n("{key}")"/>
|
||||||
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -21,9 +21,11 @@ import java.io.PrintStream;
|
|||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.text.BadLocationException;
|
||||||
import javax.swing.text.Document;
|
import javax.swing.text.Document;
|
||||||
import javax.swing.text.SimpleAttributeSet;
|
import javax.swing.text.SimpleAttributeSet;
|
||||||
import javax.swing.text.StyleConstants;
|
import javax.swing.text.StyleConstants;
|
||||||
|
import javax.swing.text.StyledDocument;
|
||||||
import org.jackhuang.hmcl.util.C;
|
import org.jackhuang.hmcl.util.C;
|
||||||
import org.jackhuang.hmcl.api.HMCLog;
|
import org.jackhuang.hmcl.api.HMCLog;
|
||||||
import org.jackhuang.hmcl.util.log.Level;
|
import org.jackhuang.hmcl.util.log.Level;
|
||||||
@ -39,6 +41,7 @@ import org.jackhuang.hmcl.util.ui.SwingUtils;
|
|||||||
* @author huangyuhui
|
* @author huangyuhui
|
||||||
*/
|
*/
|
||||||
public class LogWindow extends javax.swing.JFrame {
|
public class LogWindow extends javax.swing.JFrame {
|
||||||
|
|
||||||
public static LogWindowOutputStream outputStream;
|
public static LogWindowOutputStream outputStream;
|
||||||
|
|
||||||
NonFunction<Boolean> listener;
|
NonFunction<Boolean> listener;
|
||||||
@ -56,8 +59,9 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
txtLog.setEditable(false);
|
//txtLog.setEditable(false);
|
||||||
txtLog.setFont(Settings.getInstance().getConsoleFont());
|
txtLog.setFont(Settings.getInstance().getConsoleFont());
|
||||||
|
cboShowLines.setSelectedItem(String.valueOf(Settings.getInstance().getLogLines()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,13 +84,15 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
btnTerminateGame = new javax.swing.JButton();
|
btnTerminateGame = new javax.swing.JButton();
|
||||||
pnlLog = new javax.swing.JScrollPane();
|
pnlLog = new javax.swing.JScrollPane();
|
||||||
txtLog = new JLineWrapTextPane();
|
txtLog = new JLineWrapTextPane();
|
||||||
jLabel1 = new javax.swing.JLabel();
|
lblShowLines = new javax.swing.JLabel();
|
||||||
cboShowLines = new javax.swing.JComboBox<>();
|
cboShowLines = new javax.swing.JComboBox<>();
|
||||||
btnDebug = new javax.swing.JToggleButton();
|
btnDebug = new javax.swing.JToggleButton();
|
||||||
btnInfo = new javax.swing.JToggleButton();
|
btnInfo = new javax.swing.JToggleButton();
|
||||||
btnWarn = new javax.swing.JToggleButton();
|
btnWarn = new javax.swing.JToggleButton();
|
||||||
btnError = new javax.swing.JButton();
|
btnError = new javax.swing.JButton();
|
||||||
btnFatal = new javax.swing.JButton();
|
btnFatal = new javax.swing.JButton();
|
||||||
|
txtSearch = new javax.swing.JTextField();
|
||||||
|
lblSearch = new javax.swing.JLabel();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
setTitle(C.i18n("logwindow.title")); // NOI18N
|
setTitle(C.i18n("logwindow.title")); // NOI18N
|
||||||
@ -133,10 +139,11 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
txtLog.setEditable(false);
|
||||||
pnlLog.setViewportView(txtLog);
|
pnlLog.setViewportView(txtLog);
|
||||||
|
|
||||||
jLabel1.setText("显示行数");
|
lblShowLines.setText(C.i18n("logwindow.show_lines")); // NOI18N
|
||||||
jLabel1.setToolTipText("");
|
lblShowLines.setToolTipText("");
|
||||||
|
|
||||||
cboShowLines.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "100", "1000", "5000" }));
|
cboShowLines.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "100", "1000", "5000" }));
|
||||||
cboShowLines.addItemListener(new java.awt.event.ItemListener() {
|
cboShowLines.addItemListener(new java.awt.event.ItemListener() {
|
||||||
@ -145,15 +152,24 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnDebug.setText("debugs");
|
btnDebug.setText("0 debug");
|
||||||
|
|
||||||
btnInfo.setText("infos");
|
btnInfo.setText("0 info");
|
||||||
|
|
||||||
btnWarn.setText("warns");
|
btnWarn.setText("0 warn");
|
||||||
|
|
||||||
btnError.setText("errors");
|
btnError.setText("0 error");
|
||||||
|
|
||||||
btnFatal.setText("fatals");
|
btnFatal.setText("0 fatal");
|
||||||
|
|
||||||
|
txtSearch.setToolTipText("");
|
||||||
|
txtSearch.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
txtSearchActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lblSearch.setText(C.i18n("logwindow.search")); // NOI18N
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@ -164,7 +180,7 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addComponent(btnContact)
|
.addComponent(btnContact)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 183, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 144, Short.MAX_VALUE)
|
||||||
.addComponent(btnTerminateGame)
|
.addComponent(btnTerminateGame)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnCopy)
|
.addComponent(btnCopy)
|
||||||
@ -174,10 +190,14 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
.addComponent(btnClose))
|
.addComponent(btnClose))
|
||||||
.addComponent(lblCrash, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(lblCrash, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(jLabel1)
|
.addComponent(lblShowLines)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(cboShowLines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(cboShowLines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(lblSearch)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(txtSearch)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnFatal)
|
.addComponent(btnFatal)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnError)
|
.addComponent(btnError)
|
||||||
@ -195,13 +215,15 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(jLabel1)
|
.addComponent(lblShowLines)
|
||||||
.addComponent(cboShowLines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(cboShowLines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(btnDebug)
|
.addComponent(btnDebug)
|
||||||
.addComponent(btnInfo)
|
.addComponent(btnInfo)
|
||||||
.addComponent(btnWarn)
|
.addComponent(btnWarn)
|
||||||
.addComponent(btnError)
|
.addComponent(btnError)
|
||||||
.addComponent(btnFatal))
|
.addComponent(btnFatal)
|
||||||
|
.addComponent(txtSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(lblSearch))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(lblCrash)
|
.addComponent(lblCrash)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
@ -251,6 +273,42 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
Settings.getInstance().setLogLines(Integer.parseInt(cboShowLines.getSelectedItem().toString()));
|
Settings.getInstance().setLogLines(Integer.parseInt(cboShowLines.getSelectedItem().toString()));
|
||||||
}//GEN-LAST:event_cboShowLinesItemStateChanged
|
}//GEN-LAST:event_cboShowLinesItemStateChanged
|
||||||
|
|
||||||
|
private void txtSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSearchActionPerformed
|
||||||
|
if (evt.getSource() != txtSearch || txtSearch.getText().isEmpty())
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
if (!s.equals(txtSearch.getText()))
|
||||||
|
pos = 0;
|
||||||
|
StyledDocument d = txtLog.getStyledDocument();
|
||||||
|
s = txtSearch.getText();
|
||||||
|
String content = d.getText(0, d.getLength());
|
||||||
|
int x = content.indexOf(s, pos);
|
||||||
|
if (x == -1) {
|
||||||
|
pos = 0;
|
||||||
|
x = content.indexOf(s, pos);
|
||||||
|
}
|
||||||
|
if (x == -1)
|
||||||
|
return;
|
||||||
|
int len = s.length();
|
||||||
|
pos = x + len;
|
||||||
|
SimpleAttributeSet set = new SimpleAttributeSet(d.getLogicalStyle(x).copyAttributes());
|
||||||
|
StyleConstants.setBackground(set, txtLog.getSelectionColor());
|
||||||
|
StyleConstants.setForeground(set, txtLog.getSelectedTextColor());
|
||||||
|
d.setCharacterAttributes(x, len, set, true);
|
||||||
|
set = new SimpleAttributeSet(d.getLogicalStyle(lastX).copyAttributes());
|
||||||
|
StyleConstants.setBackground(set, txtLog.getBackground());
|
||||||
|
StyleConstants.setForeground(set, txtLog.getForeground());
|
||||||
|
d.setCharacterAttributes(lastX, lastLen, set, true);
|
||||||
|
txtLog.select(x, pos);
|
||||||
|
lastX = x;
|
||||||
|
lastLen = len;
|
||||||
|
} catch (BadLocationException e) {
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_txtSearchActionPerformed
|
||||||
|
|
||||||
|
String s = "";
|
||||||
|
int pos = 0, lastX = 0, lastLen = 0;
|
||||||
|
|
||||||
void terminateGames() {
|
void terminateGames() {
|
||||||
ProcessMonitor.stopAll();
|
ProcessMonitor.stopAll();
|
||||||
}
|
}
|
||||||
@ -284,11 +342,21 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case FATAL: btnFatal.setText(++fatals + " fatals"); break;
|
case FATAL:
|
||||||
case ERROR: btnError.setText(++errors + " errors"); break;
|
btnFatal.setText(++fatals + " fatals");
|
||||||
case WARN: btnWarn.setText(++warns + " warns"); break;
|
break;
|
||||||
case INFO: btnInfo.setText(++infos + " infos"); break;
|
case ERROR:
|
||||||
case DEBUG: btnDebug.setText(++debugs + " debugs"); break;
|
btnError.setText(++errors + " errors");
|
||||||
|
break;
|
||||||
|
case WARN:
|
||||||
|
btnWarn.setText(++warns + " warns");
|
||||||
|
break;
|
||||||
|
case INFO:
|
||||||
|
btnInfo.setText(++infos + " infos");
|
||||||
|
break;
|
||||||
|
case DEBUG:
|
||||||
|
btnDebug.setText(++debugs + " debugs");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxLines = Integer.parseInt(cboShowLines.getSelectedItem().toString());
|
int maxLines = Integer.parseInt(cboShowLines.getSelectedItem().toString());
|
||||||
@ -314,8 +382,6 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean b) {
|
public void setVisible(boolean b) {
|
||||||
cboShowLines.setSelectedItem(Settings.getInstance().getLogLines());
|
|
||||||
|
|
||||||
txtLog.setFont(Settings.getInstance().getConsoleFont());
|
txtLog.setFont(Settings.getInstance().getConsoleFont());
|
||||||
lblCrash.setVisible(false);
|
lblCrash.setVisible(false);
|
||||||
btnContact.setVisible(false);
|
btnContact.setVisible(false);
|
||||||
@ -323,8 +389,6 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showAsCrashWindow(boolean out_date) {
|
public void showAsCrashWindow(boolean out_date) {
|
||||||
cboShowLines.setSelectedItem(Settings.getInstance().getLogLines());
|
|
||||||
|
|
||||||
txtLog.setFont(Settings.getInstance().getConsoleFont());
|
txtLog.setFont(Settings.getInstance().getConsoleFont());
|
||||||
if (out_date) {
|
if (out_date) {
|
||||||
lblCrash.setVisible(false);
|
lblCrash.setVisible(false);
|
||||||
@ -351,9 +415,11 @@ public class LogWindow extends javax.swing.JFrame {
|
|||||||
private javax.swing.JButton btnTerminateGame;
|
private javax.swing.JButton btnTerminateGame;
|
||||||
private javax.swing.JToggleButton btnWarn;
|
private javax.swing.JToggleButton btnWarn;
|
||||||
private javax.swing.JComboBox<String> cboShowLines;
|
private javax.swing.JComboBox<String> cboShowLines;
|
||||||
private javax.swing.JLabel jLabel1;
|
|
||||||
private javax.swing.JLabel lblCrash;
|
private javax.swing.JLabel lblCrash;
|
||||||
|
private javax.swing.JLabel lblSearch;
|
||||||
|
private javax.swing.JLabel lblShowLines;
|
||||||
private javax.swing.JScrollPane pnlLog;
|
private javax.swing.JScrollPane pnlLog;
|
||||||
private javax.swing.JTextPane txtLog;
|
private javax.swing.JTextPane txtLog;
|
||||||
|
private javax.swing.JTextField txtSearch;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Hello Minecraft! Launcher.
|
|
||||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
||||||
*/
|
|
||||||
package org.jackhuang.hmcl.util.log;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author huang
|
|
||||||
*/
|
|
||||||
public class Parser {
|
|
||||||
|
|
||||||
}
|
|
@ -392,6 +392,8 @@ update.found=(Found Update!)
|
|||||||
logwindow.terminate_game=Terminate Game
|
logwindow.terminate_game=Terminate Game
|
||||||
logwindow.title=Log
|
logwindow.title=Log
|
||||||
logwindow.contact=Contact Us
|
logwindow.contact=Contact Us
|
||||||
|
logwindow.show_lines=Show Lines
|
||||||
|
logwindow.search=Search
|
||||||
|
|
||||||
selector.choose=Choose
|
selector.choose=Choose
|
||||||
|
|
||||||
|
@ -392,6 +392,8 @@ update.found=(Found Update!)
|
|||||||
logwindow.terminate_game=Terminate Game
|
logwindow.terminate_game=Terminate Game
|
||||||
logwindow.title=Log
|
logwindow.title=Log
|
||||||
logwindow.contact=Contact Us
|
logwindow.contact=Contact Us
|
||||||
|
logwindow.show_lines=Show Lines
|
||||||
|
logwindow.search=Search
|
||||||
|
|
||||||
selector.choose=Choose
|
selector.choose=Choose
|
||||||
|
|
||||||
|
@ -390,6 +390,8 @@ update.found=(Đã tìm thấy bản cập nhật!)
|
|||||||
logwindow.terminate_game=Tắt Game
|
logwindow.terminate_game=Tắt Game
|
||||||
logwindow.title=HMCL Error Log (Hãy đăng cái này lên forum!)
|
logwindow.title=HMCL Error Log (Hãy đăng cái này lên forum!)
|
||||||
logwindow.contact=Contact Us
|
logwindow.contact=Contact Us
|
||||||
|
logwindow.show_lines=Show Lines
|
||||||
|
logwindow.search=Search
|
||||||
|
|
||||||
selector.choose=Chọn
|
selector.choose=Chọn
|
||||||
|
|
||||||
|
@ -390,6 +390,8 @@ update.found=(\u0110\u00e3 t\u00ecm th\u1ea5y b\u1ea3n c\u1eadp nh\u1eadt!)
|
|||||||
logwindow.terminate_game=T\u1eaft Game
|
logwindow.terminate_game=T\u1eaft Game
|
||||||
logwindow.title=HMCL Error Log (H\u00e3y \u0111\u0103ng c\u00e1i n\u00e0y l\u00ean forum!)
|
logwindow.title=HMCL Error Log (H\u00e3y \u0111\u0103ng c\u00e1i n\u00e0y l\u00ean forum!)
|
||||||
logwindow.contact=Contact Us
|
logwindow.contact=Contact Us
|
||||||
|
logwindow.show_lines=Show Lines
|
||||||
|
logwindow.search=Search
|
||||||
|
|
||||||
selector.choose=Ch\u1ecdn
|
selector.choose=Ch\u1ecdn
|
||||||
|
|
||||||
|
@ -392,6 +392,8 @@ update.found=(發現更新!)
|
|||||||
logwindow.terminate_game=結束遊戲進程
|
logwindow.terminate_game=結束遊戲進程
|
||||||
logwindow.title=日誌
|
logwindow.title=日誌
|
||||||
logwindow.contact=聯繫我們
|
logwindow.contact=聯繫我們
|
||||||
|
logwindow.show_lines=顯示行數
|
||||||
|
logwindow.search=查找
|
||||||
|
|
||||||
selector.choose=選擇
|
selector.choose=選擇
|
||||||
|
|
||||||
|
@ -392,6 +392,8 @@ update.found=(\u767c\u73fe\u66f4\u65b0!)
|
|||||||
logwindow.terminate_game=\u7d50\u675f\u904a\u6232\u9032\u7a0b
|
logwindow.terminate_game=\u7d50\u675f\u904a\u6232\u9032\u7a0b
|
||||||
logwindow.title=\u65e5\u8a8c
|
logwindow.title=\u65e5\u8a8c
|
||||||
logwindow.contact=\u806f\u7e6b\u6211\u5011
|
logwindow.contact=\u806f\u7e6b\u6211\u5011
|
||||||
|
logwindow.show_lines=\u986f\u793a\u884c\u6578
|
||||||
|
logwindow.search=\u67e5\u627e
|
||||||
|
|
||||||
selector.choose=\u9078\u64c7
|
selector.choose=\u9078\u64c7
|
||||||
|
|
||||||
|
@ -392,6 +392,8 @@ update.found=(发现更新!)
|
|||||||
logwindow.terminate_game=结束游戏进程
|
logwindow.terminate_game=结束游戏进程
|
||||||
logwindow.title=日志
|
logwindow.title=日志
|
||||||
logwindow.contact=联系我们
|
logwindow.contact=联系我们
|
||||||
|
logwindow.show_lines=显示行数
|
||||||
|
logwindow.search=查找
|
||||||
|
|
||||||
selector.choose=选择
|
selector.choose=选择
|
||||||
|
|
||||||
|
@ -392,6 +392,8 @@ update.found=(\u53d1\u73b0\u66f4\u65b0!)
|
|||||||
logwindow.terminate_game=\u7ed3\u675f\u6e38\u620f\u8fdb\u7a0b
|
logwindow.terminate_game=\u7ed3\u675f\u6e38\u620f\u8fdb\u7a0b
|
||||||
logwindow.title=\u65e5\u5fd7
|
logwindow.title=\u65e5\u5fd7
|
||||||
logwindow.contact=\u8054\u7cfb\u6211\u4eec
|
logwindow.contact=\u8054\u7cfb\u6211\u4eec
|
||||||
|
logwindow.show_lines=\u663e\u793a\u884c\u6570
|
||||||
|
logwindow.search=\u67e5\u627e
|
||||||
|
|
||||||
selector.choose=\u9009\u62e9
|
selector.choose=\u9009\u62e9
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user