use of javax.swing.text.SimpleAttributeSet in project LogisticsPipes by RS485.
the class DebugWindow method showInfo.
public void showInfo(String data, Color color) {
SimpleAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setFontFamily(attr, "SansSerif");
StyleConstants.setFontSize(attr, 12);
StyleConstants.setForeground(attr, color);
Document document = textArea.getDocument();
if (document != null) {
try {
document.insertString(document.getLength(), data, attr);
} catch (BadLocationException ignored) {
}
}
getContentPane().validate();
}
use of javax.swing.text.SimpleAttributeSet in project LogisticsPipes by RS485.
the class LogWindow method newLine.
public void newLine(String data) {
SimpleAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setFontFamily(attr, "SansSerif");
StyleConstants.setFontSize(attr, 12);
// StyleConstants.setForeground(attr, color);
Document document = logArea.getDocument();
if (document != null) {
try {
document.insertString(document.getLength(), data + "\n", attr);
} catch (BadLocationException ignored) {
}
}
validate();
}
use of javax.swing.text.SimpleAttributeSet in project Botnak by Gocnak.
the class ChatPane method onWhisper.
public void onWhisper(MessageWrapper m) {
SimpleAttributeSet senderSet, receiverSet;
long sender = m.getLocal().getSenderID();
String receiver = (String) m.getLocal().getExtra();
print(m, "\n" + getTime(), GUIMain.norm);
User senderUser = Settings.channelManager.getUser(sender, true);
User receiverUser = Settings.channelManager.getUser(receiver, true);
senderSet = getUserSet(senderUser);
receiverSet = getUserSet(receiverUser);
// name stuff
print(m, " ", GUIMain.norm);
FaceManager.handleNameFaces(senderUser.getUserID(), senderSet);
FaceManager.handleNameFaces(receiverUser.getUserID(), receiverSet);
print(m, senderUser.getDisplayName(), senderSet);
print(m, " (whisper)-> ", GUIMain.norm);
print(m, receiverUser.getDisplayName(), receiverSet);
print(m, ": ", GUIMain.norm);
printMessage(m, m.getLocal().getContent(), GUIMain.norm, senderUser);
}
use of javax.swing.text.SimpleAttributeSet in project Botnak by Gocnak.
the class ChatPane method insertIcon.
public void insertIcon(MessageWrapper m, IconEnum type, String channel) {
SimpleAttributeSet attrs = new SimpleAttributeSet();
Icons.BotnakIcon icon = Icons.getIcon(type, channel);
StyleConstants.setIcon(attrs, icon.getImage());
try {
print(m, " ", null);
print(m, icon.getType().type, attrs);
} catch (Exception e) {
GUIMain.log("Exception in insertIcon: ");
GUIMain.log(e);
}
}
use of javax.swing.text.SimpleAttributeSet in project Botnak by Gocnak.
the class ChatPane method getUserSet.
private SimpleAttributeSet getUserSet(User u) {
SimpleAttributeSet user = new SimpleAttributeSet();
StyleConstants.setFontFamily(user, Settings.font.getValue().getFamily());
StyleConstants.setFontSize(user, Settings.font.getValue().getSize());
StyleConstants.setForeground(user, Utils.getColorFromUser(u));
user.addAttribute(HTML.Attribute.NAME, u.getDisplayName());
return user;
}
Aggregations