Import txt file into user dictionary
How to import text file into user dictionary through javascript? I can manually import txt file into user dictionary thru "Edit=>Spelling=>User dictionary...". But I don't know how to do it using javascript. Please advise.
Advice? See in some version of the object-model reference under userDictionary. There you'll find a method called addWord(), which looks promising.
Peter
Similar Messages
-
Hi all,
I was created table A with A1 and A2 columns.
create table A (number A1, varchar A2).
I have file.txt from my desktop like
1,elementA
2,elementKK
3,elementMM
1000,element YIIO
How to import this file into table A with A1 have number and A2 have elements
from txt file using sql plus editor?
Thanks in advanceHi,
Below example using External Table Feature.
create a directory on the server where your database is installed and copy your data file(text file) in that directory. In the below example Oracle directory name is "text_file" and the physical directory on the server is "D:\TEXT_FILE\". The file name of data file is "data.txt".
create directory text_file as 'D:\TEXT_FILE\';
DROP TABLE load_a;
CREATE TABLE load_a
(a1 varchar2(20),
a2 varchar2(200))
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY text_file
ACCESS PARAMETERS
(FIELDS TERMINATED BY ','
LOCATION ('data.txt')
select * from load_a;
now you can use
insert into a select * from load_a;
Sachin Chauhan -
I have an Arinc signal that I have decoded into each of its digital I/Os. Since I have over 150 I/Os I needed a way to sort and do a quick report on them.
I have three categories.
1. Stayed =1 throughout test
2. Stayed = 0 throughout test
3. Changed either from 0 --> 1 or 1-->0 during the test.
I want to just put a list of the signals for each of these categories into my report.
I have created a txt file for these to go in, but how do I import that into my report?
Or is there an easier way?
Here is an example of my code...
'HCM1
'HCM1 Label 104 decode - Untitled 3
Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HSOV_A1_CLOSED"")= GetB (Ch(""[1]/Untitled 3""),0)")
Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HSOV_A2_CLOSED"")= GetB (Ch(""[1]/Untitled 3""),1)")
Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HPP_A_RUNNING"")= GetB (Ch(""[1]/Untitled 3""),2)")
Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_SYS_A_HI_TEMP"")= GetB (Ch(""[1]/Untitled 3""),4)")
Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_SYS_A_LO_PRS"")= GetB (Ch(""[1]/Untitled 3""),7)")
Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HPP_A_LO_PRS"")= GetB (Ch(""[1]/Untitled 3""),12)")
Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HPP_A_HI_TEMP"")= GetB (Ch(""[1]/Untitled 3""),13)")
'HCM1 Label 105 decode - Untitled 4
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HSOV_A1_FAIL"")= GetB (Ch(""[1]/Untitled 4""),0)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HSOV_A2_FAIL"")= GetB (Ch(""[1]/Untitled 4""),1)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A1_FAIL"")= GetB (Ch(""[1]/Untitled 4""),2)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A2_FAIL"")= GetB (Ch(""[1]/Untitled 4""),3)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_SYS_A_PRS_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),6)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_SYS_A_RET_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),7)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A1_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),8)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A2_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),9)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HPP_A_LO_QTY"")= GetB (Ch(""[1]/Untitled 4""),11)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HPP_A_FAIL"")= GetB (Ch(""[1]/Untitled 4""),12)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HPP_A_CDF_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),14)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_IV_A_FAIL"")= GetB (Ch(""[1]/Untitled 4""),15)")
Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_IV_A_FAIL_LOCAL"")= GetB (Ch(""[1]/Untitled 4""),16)")
'HCM1 Label 106 decode - Untitled 5
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_PF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),0)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_RF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),1)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A1_CDF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),2)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A2_CDF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),3)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A1_PS_FAIL"")= GetB (Ch(""[1]/Untitled 5""),4)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A2_PS_FAIL"")= GetB (Ch(""[1]/Untitled 5""),5)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_PX_FAIL"")= GetB (Ch(""[1]/Untitled 5""),6)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_TX_FAIL"")= GetB (Ch(""[1]/Untitled 5""),7)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_QX_FAIL"")= GetB (Ch(""[1]/Untitled 5""),8)")
Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A1_IND_FAIL"")= GetB (Ch(""[1]/Untitled 5""),10)")
Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A2_IND_FAIL"")= GetB (Ch(""[1]/Untitled 5""),11)")
Call Calculate ("Ch(""HCM1_106/HCM_1_EDP_A1_FAIL"")= GetB (Ch(""[1]/Untitled 5""),12)")
Call Calculate ("Ch(""HCM1_106/HCM_1_EDP_A2_FAIL"")= GetB (Ch(""[1]/Untitled 5""),13)")
Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_FV_A_FAIL"")= GetB (Ch(""[1]/Untitled 5""),14)")
Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A1_RELAY_FAIL"")= GetB (Ch(""[1]/Untitled 5""),15)")
Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A2_RELAY_FAIL"")= GetB (Ch(""[1]/Untitled 5""),16)")
Dim k, m, pMyChn, result, ArincTrue, intMyHandle01, intMyHandle02,intMyHandle03,intMyText, intMyError01, intMyError02, intMyError03
intMyHandle01 = TextFileOpen("C:\ArincTrue.txt",tfCreate or tfWrite)
intMyHandle02 = TextFileOpen("C:\ArincFalse.txt",tfCreate or tfWrite)
intMyHandle03 = TextFileOpen("C:\ArincChange.txt",tfCreate or tfWrite)
For k = 2 to 4
For m = 1 to GroupChnCount(k)
Set pMyChn = Data.Root.ChannelGroups(k).Channels(m)
Result = ChnValMax(pMyChn)-ChnValMin(pMyChn)
If Result = 0 and ChnValMax(pMyChn) > 0 then
intMyText= TextfileWriteLn(intMyHandle01, pMyChn.Name)
elseif result= 0 and ChnValMax(PMyChn) = 0 then
intMyText= TextfileWriteLn(intMyHandle02, pMyChn.Name)
else
intMyText= TextfileWriteLn(intMyHandle03, pMyChn.Name)
End If
Next
Next
intMyError01 = TextFileClose(intMyHandle01)
intMyError02 = TextFileClose(intMyHandle02)
intMyError03 = TextFileClose(intMyHandle03)
Solved!
Go to Solution.Hi 2Pale4TX,
You can't easily reference the content of an ASCII file. Instead, I suggest you make a new Group of 3 text channels that you can drag onto a REPORT table.
Dim k, m, z, ResultsGroup, TrueChannel, FalseChannel, ChangeChannel, Group, Channel, Result
Set ResultsGroup = Data.Root.ChannelGroups.Add("Results")
Set TrueChannel = ResultsGroup.Channels.Add("ArincTrue", DataTypeString)
Set FalseChannel = ResultsGroup.Channels.Add("ArincFalse", DataTypeString)
Set ChangeChannel = ResultsGroup.Channels.Add("ArincChange", DataTypeString)
For k = 2 to 4
Set Group = Data.Root.ChannelGroups(k)
For m = 1 to Group.Channels.Count
Set Channel = Group.Channels(m)
ChMax = CMax(Channel)
ChMin = CMin(Channel)
Result = ChMax - ChMin
If Result = 0 and ChMax > 0 Then
z = TrueChannel.Size + 1
TrueChannel(z) = Channel.Name
Elseif Result = 0 and ChMax = 0 Then
z = FalseChannel.Size + 1
FalseChannel(z) = Channel.Name
Else
z = ChangeChannel.Size + 1
ChangeChannel(z) = Channel.Name
End If
Next ' m
Next ' k
Brad Turpin
DIAdem Product Support Engineer
National Instruments -
Automator-How to batch import txt files into excel
Hi
I have been using Automator to import hundreds of text files into one excel workbook using the "Import Text files to Excel Workbook" action. Automator works great for all files that are tab delimited. However I have another set of data that are output with a varying amount of spaces between each column. I cannot change the way they are output. Automator gives me the option of choosing "space" as a delimiter, but it wont give me the option to "Treat consecutive delimiters as one" that Import within excel does. I also tried to record my actions within excel many times but it didn't work even with just one file. So what I need is a way to get these text files into one excel workbook as separate worksheets with the data separated correctly into columns.
Any help would be great!I'm confused by the "I cannot change the way they are output" line: What's stopping you from reimporting them into excel and resaving them as tab delimited? Converting from fixed-format to tab-delimited is always a bit of a pain (it involves chunking each line to the correct sized bits and then stripping whitespace from the end - doable in applescript and shell scripting, but a headache to get right); no sense remaking the wheel if you can get Excel to do it for you.
-
I want to import txt file into a QT Movie. But under the pulldown menu is not a import icon.
How can I import the text file.So once you choose open file what do you do from there? How do I get the text file into the movie?
-
How can I import a file into my Windows Phone 8.1RT App?
Hi All,
I'm running into a bit of an issue associating my app with a custom file type. Users create a file using my app and upload it to their OneDrive for sharing. So I then want to give the users the ability to download the file from a share link and
have that file open automatically in my app. I've got the appropriate declarations set and file type associations, but I'm getting a file access exception when I try to open the file. Whats the best way to import a file into my app? Here's
the code I've got so far:
protected override async void OnFileActivated(FileActivatedEventArgs args)
var path = args.Files[0].Path;
var name = args.Files[0].Name;
StorageFile newFile = await StorageFile.GetFileFromPathAsync(path);
await newFile.CopyAsync(ApplicationData.Current.LocalFolder, name.Substring(0, name.Length - 4));
The path comes back as
C:\Data\Users\DefApps\APPDATA\Local\Packages\microsoft.microsoftskydrive_8weke\LocalState\OpenWithTempFolder\e68c261-db3b-472d-a8b7-93427450\File Name.extension
and the exception is
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Clearly I'm trying to access the file in an inappropriate way, so what's the best way to get the file into my app's local storage?You have the StorageFile in arg.Files[0] already. Just use that rather than getting its path and then trying to create a new StorageFile from it.
var path = args.Files[0].Path; // <= Path is unnecessary and unhelpful
var name = args.Files[0].Name;
await args.Files[0].CopyAsync(ApplicationData.Current.LocalFolder, name.Substring(0, name.Length - 4));
See my blog entry Skip the path: stick to the StorageFile for more details. -
Error while importing tpz file into XI Design
Hi All,
When i am trying to import latest exported tpz file from Dev system into Q system i am getting below error.
Also the tpz file i am importing , with same file name already i have imported earlier into Q system through other Dev system. Now i am importing the exported file through prod fix environment dev system. Please help me , how to import the file without this error. Also, how to avaoid duplicate file name for importing tpz files or overwrite exiting imported tpz file which is having same file name.
Batch rolled back. Caused by java.sql.BatchUpdateException: ORA-00001: unique constraint (SAPSR3DB.SYS_C00136623) violated at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10698) at com.sap.sql.jdbc.basic.BasicPreparedStatement.executeBatch(BasicPreparedStatement.java:263) at com.sap.sql.jdbc.oracle.Oracle10gPreparedStatement.executeBatch(Oracle10gPreparedStatement.java:100) at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeBatch(DirectPreparedStatement.java:1129) at com.sap.sql.jdbc.common.CommonPreparedStatement.executeBatch(CommonPreparedStatement.java:991) at com.sap.engine.services.dbpool.wrappers.StatementWrapper.executeBatch(StatementWrapper.java:270) at com.tssap.dtr.pvc.basics.transaction.StatementReleasingConnection.executeBatch(StatementReleasingConnection.java:297) at com.tssap.dtr.pvc.versionmg.DefaultIntegrator.fireSQLBatches(DefaultIntegrator.java:1072) at com.tssap.dtr.pvc.versionmg.DefaultIntegrator.executeDBUpdates(DefaultIntegrator.java:384) at com.tssap.dtr.pvc.versionmg.DefaultIntegrator.integrate(DefaultIntegrator.java:337) at com.tssap.dtr.pvc.versionmg.VersionSet.integrate(VersionSet.java:183) at com.sap.aii.ib.server.pvcadapt.ImmutableVersionSet.integrate(ImmutableVersionSet.java:197) at com.sap.aii.ib.server.versioning.integration.VersionSetIntegratorImpl._integrateUnconditionally(VersionSetIntegratorImpl.java:300) at com.sap.aii.ib.server.versioning.integration.VersionSetIntegratorImpl.integrateClosedVersionSet(VersionSetIntegratorImpl.java:119) at com.sap.aii.ib.server.versioning.integration.VersionSetIntegrator.integrateClosedVersionSet(VersionSetIntegrator.java:52) at com.sap.aii.ib.server.propagation.PropagatorImpl.integrateObjectVersions(PropagatorImpl.java:261) at com.sap.aii.ib.server.propagation.Propagator.integrateObjectVersions(Propagator.java:174) at com.sap.aii.ib.server.transport.impl.pvc.PvcTransport.pvcIntegrate(PvcTransport.java:191) at com.sap.aii.ib.server.transport.impl.service.InternalTransportServiceImpl.integrateVersionset(InternalTransportServiceImpl.java:480) at com.sap.aii.ibrep.server.transport.impl.service.InternalRepTransportServiceImpl.autoIntegrate(InternalRepTransportServiceImpl.java:546) at com.sap.aii.ib.server.transport.impl.service.InternalTransportServiceImpl.importZippedStream(InternalTransportServiceImpl.java:716) at com.sap.aii.ib.server.transport.impl.service.InternalTransportServiceImpl.importFromImportSource(InternalTransportServiceImpl.java:362) at com.sap.aii.ib.server.transport.impl.service.TransportServiceImpl.importFromImportSource(TransportServiceImpl.java:151) at com.sap.aii.ib.sbeans.transport.TransportServiceBean.importFromImportSource(TransportServiceBean.java:75) at com.sap.aii.ib.sbeans.transport.TransportServiceRemoteObjectImpl1_0.importFromImportSource(TransportServiceRemoteObjectImpl1_0.java:730) at com.sap.aii.ib.sbeans.transport.TransportServiceRemoteObjectImpl1_0p4_Skel.dispatch(TransportServiceRemoteObjectImpl1_0p4_Skel.java:100) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:312) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:199)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Thanks in advance.
Rajesh
Edited by: rajesh amrabad on Sep 11, 2008 10:35 PMIn addition to abobe answers,
Keep this .tpz file at below mentioned location
\usr\sap\<SID>\SYS\global\xi\repository_server\import\XI7_0_SAP_BASIS_7.00_09_00.tpz
then login to the IR and peoceed as Tools -
> import design objects. Her you will get this .tpz file, just import it.
follow the steps given in this link and check if you are doing the correct thing.
http://help.sap.com/saphelp_nw04/helpdata/en/93/a3a74046033913e10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/ef/a21e3e0987760be10000000a114084/content.htm
The steps that you require are listed below,
1) You must have the role SAP_XI_ADMINISTRATOR or SAP_XI_CONTENT_ORGANIZER to be able to export and import XI content.
2)You import the XI content by first copying the provided export files into an import directory on the host of the Integration Builder and then importing the files into the Integration Repository.
3)Copy the export files into the import directory for the Integration Repository (<systemDir>\xi\repository_server\import).If the files are packed, you must unpack them before importing.The actual export files have the extension .tpz. You must not unpack these files.
4)The import directory is created the first time you call the Integration Builder.
5)Start the Integration Builder and call the Integration Repository.
To do this, perform the following steps:
a. Log on to the SAP system on which your Integration Builder has been installed.
b. Open the Integration Builder start page by calling it either from your user menu or with Transaction SXMB_IFR.
c. Choose Integration Repository.
Choose Tools u00AE Import design objects to import the XI content.
6)Only the files from the import directory are offered to be imported. The sequence in which
you import the export files is not important.
7)After a successful import, the Integration Builder moves the imported TPZ files into the directory <systemDir>/xi/repository_server/importedFiles. The support package stack of imported software component versions is displayed on the Details tab page for the relevant software component version in the Integration Builder. If an error occurs, this information is important for support.
Hope i have been of some help. -
Problem reading .txt-file into JTable
My problem is that I�m reading a .txt-file into a J-Table. It all goes okay, the FileChooser opens and the application reads the selected file (line). But then I get a Null Pointer Exception and the JTable does not get updated with the text from the file.
Here�s my code (I kept it simple, and just want to read the text from the .txt-file to the first cell of the table.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.util.*;
import java.lang.*;
import java.io.*;
public class TeamTable extends JFrame implements ActionListener, ItemListener {
static JTable table;
// constructor
public TeamTable() {
super( "Invoermodule - Team Table" );
setSize( 740, 365 );
// setting the rownames
ListModel listModel = new AbstractListModel() {
String headers[] = {"Team 1", "Team 2", "Team 3", "Team 4", "Team 5", "Team 6", "Team 7", "Team 8", "Team 9",
"Team 10", "Team 11", "Team 12", "Team 13", "Team 14", "Team 15", "Team 16", "Team 17", "Team 18"};
public int getSize() { return headers.length; }
public Object getElementAt(int index) { return headers[index]; }
// add listModel & rownames to the table
DefaultTableModel defaultModel = new DefaultTableModel(listModel.getSize(),3);
JTable table = new JTable( defaultModel );
// setting the columnnames and center alignment of table cells
int width = 200;
int[] vColIndex = {0,1,2};
String[] ColumnName = {"Name Team", "Name Chairman", "Name Manager"};
TableCellRenderer centerRenderer = new CenterRenderer();
for (int i=0; i < vColIndex.length;i++) {
table.getColumnModel().getColumn(vColIndex).setHeaderValue(ColumnName[i]);
table.getColumnModel().getColumn(vColIndex[i]).setPreferredWidth(width);
table.getColumnModel().getColumn(vColIndex[i]).setCellRenderer(centerRenderer);
table.setFont(new java.awt.Font("Dialog", Font.ITALIC, 12));
// force the header to resize and repaint itself
table.getTableHeader().resizeAndRepaint();
// create single component to add to scrollpane (rowHeader is JList with argument listModel)
JList rowHeader = new JList(listModel);
rowHeader.setFixedCellWidth(100);
rowHeader.setFixedCellHeight(table.getRowHeight());
rowHeader.setCellRenderer(new RowHeaderRenderer(table));
// add to scroll pane:
JScrollPane scroll = new JScrollPane( table );
scroll.setRowHeaderView(rowHeader); // Adds row-list left of the table
getContentPane().add(scroll, BorderLayout.CENTER);
// add menubar, menu, menuitems with evenlisteners to the frame.
JMenuBar menubar = new JMenuBar();
setJMenuBar (menubar);
JMenu filemenu = new JMenu("File");
menubar.add(filemenu);
JMenuItem open = new JMenuItem("Open");
JMenuItem save = new JMenuItem("Save");
JMenuItem exit = new JMenuItem("Exit");
open.addActionListener(this);
save.addActionListener(this);
exit.addActionListener(this);
filemenu.add(open);
filemenu.add(save);
filemenu.add(exit);
filemenu.addItemListener(this);
// ActionListener for ActionEvents on JMenuItems.
public void actionPerformed(ActionEvent e) {
String open = "Open";
String save = "Save";
String exit = "Exit";
if (e.getSource() instanceof JMenuItem) {
JMenuItem source = (JMenuItem)(e.getSource());
String x = source.getText();
if (x == open) {
System.out.println("open file");
// create JFileChooser.
String filename = File.separator+"tmp";
JFileChooser fc = new JFileChooser(new File(filename));
// set default directory.
File wrkDir = new File("C:/Documents and Settings/Erwin en G-M/Mijn documenten/Erwin/Match Day");
fc.setCurrentDirectory(wrkDir);
// show open dialog.
int returnVal = fc.showOpenDialog(null);
File selFile = fc.getSelectedFile();
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " +
fc.getSelectedFile().getName());
try {
BufferedReader invoer = new BufferedReader(new FileReader(selFile));
String line = invoer.readLine();
System.out.println(line);
// THIS IS WHERE IT GOES WRONG, I THINK
table.setValueAt(line, 1, 1);
table.fireTableDataChanged();
catch (IOException ioExc){
if (x == save) {
System.out.println("save file");
if (x == exit) {
System.out.println("exit file");
// ItemListener for ItemEvents on JMenu.
public void itemStateChanged(ItemEvent e) {
String s = "Item event detected. Event source: " + e.getSource();
System.out.println(s);
public static void main(String[] args) {
TeamTable frame = new TeamTable();
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
frame.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
System.exit(0);
frame.setVisible(true);
* Define the look/content for a cell in the row header
* In this instance uses the JTables header properties
class RowHeaderRenderer extends JLabel implements ListCellRenderer {
* Constructor creates all cells the same
* To change look for individual cells put code in
* getListCellRendererComponent method
RowHeaderRenderer(JTable table) {
JTableHeader header = table.getTableHeader();
setOpaque(true);
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
setHorizontalAlignment(CENTER);
setForeground(header.getForeground());
setBackground(header.getBackground());
setFont(header.getFont());
* Returns the JLabel after setting the text of the cell
public Component getListCellRendererComponent( JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
setText((value == null) ? "" : value.toString());
return this;My problem is that I�m reading a .txt-file into a J-Table. It all goes okay, the FileChooser opens and the application reads the selected file (line). But then I get a Null Pointer Exception and the JTable does not get updated with the text from the file.
Here�s my code (I kept it simple, and just want to read the text from the .txt-file to the first cell of the table.
A MORE READABLE VERSION !
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.util.*;
import java.lang.*;
import java.io.*;
public class TeamTable extends JFrame implements ActionListener, ItemListener {
static JTable table;
// constructor
public TeamTable() {
super( "Invoermodule - Team Table" );
setSize( 740, 365 );
// setting the rownames
ListModel listModel = new AbstractListModel() {
String headers[] = {"Team 1", "Team 2", "Team 3", "Team 4", "Team 5", "Team 6", "Team 7", "Team 8", "Team 9",
"Team 10", "Team 11", "Team 12", "Team 13", "Team 14", "Team 15", "Team 16", "Team 17", "Team 18"};
public int getSize() { return headers.length; }
public Object getElementAt(int index) { return headers[index]; }
// add listModel & rownames to the table
DefaultTableModel defaultModel = new DefaultTableModel(listModel.getSize(),3);
JTable table = new JTable( defaultModel );
// setting the columnnames and center alignment of table cells
int width = 200;
int[] vColIndex = {0,1,2};
String[] ColumnName = {"Name Team", "Name Chairman", "Name Manager"};
TableCellRenderer centerRenderer = new CenterRenderer();
for (int i=0; i < vColIndex.length;i++) {
table.getColumnModel().getColumn(vColIndex).setHeaderValue(ColumnName[i]);
table.getColumnModel().getColumn(vColIndex[i]).setPreferredWidth(width);
table.getColumnModel().getColumn(vColIndex[i]).setCellRenderer(centerRenderer);
table.setFont(new java.awt.Font("Dialog", Font.ITALIC, 12));
// force the header to resize and repaint itself
table.getTableHeader().resizeAndRepaint();
// create single component to add to scrollpane (rowHeader is JList with argument listModel)
JList rowHeader = new JList(listModel);
rowHeader.setFixedCellWidth(100);
rowHeader.setFixedCellHeight(table.getRowHeight());
rowHeader.setCellRenderer(new RowHeaderRenderer(table));
// add to scroll pane:
JScrollPane scroll = new JScrollPane( table );
scroll.setRowHeaderView(rowHeader); // Adds row-list left of the table
getContentPane().add(scroll, BorderLayout.CENTER);
// add menubar, menu, menuitems with evenlisteners to the frame.
JMenuBar menubar = new JMenuBar();
setJMenuBar (menubar);
JMenu filemenu = new JMenu("File");
menubar.add(filemenu);
JMenuItem open = new JMenuItem("Open");
JMenuItem save = new JMenuItem("Save");
JMenuItem exit = new JMenuItem("Exit");
open.addActionListener(this);
save.addActionListener(this);
exit.addActionListener(this);
filemenu.add(open);
filemenu.add(save);
filemenu.add(exit);
filemenu.addItemListener(this);
// ActionListener for ActionEvents on JMenuItems.
public void actionPerformed(ActionEvent e) {
String open = "Open";
String save = "Save";
String exit = "Exit";
if (e.getSource() instanceof JMenuItem) {
JMenuItem source = (JMenuItem)(e.getSource());
String x = source.getText();
if (x == open) {
System.out.println("open file");
// create JFileChooser.
String filename = File.separator+"tmp";
JFileChooser fc = new JFileChooser(new File(filename));
// set default directory.
File wrkDir = new File("C:/Documents and Settings/Erwin en G-M/Mijn documenten/Erwin/Match Day");
fc.setCurrentDirectory(wrkDir);
// show open dialog.
int returnVal = fc.showOpenDialog(null);
File selFile = fc.getSelectedFile();
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " +
fc.getSelectedFile().getName());
try {
BufferedReader invoer = new BufferedReader(new FileReader(selFile));
String line = invoer.readLine();
System.out.println(line);
// THIS IS WHERE IT GOES WRONG, I THINK
table.setValueAt(line, 1, 1);
table.fireTableDataChanged();
catch (IOException ioExc){
if (x == save) {
System.out.println("save file");
if (x == exit) {
System.out.println("exit file");
// ItemListener for ItemEvents on JMenu.
public void itemStateChanged(ItemEvent e) {
String s = "Item event detected. Event source: " + e.getSource();
System.out.println(s);
public static void main(String[] args) {
TeamTable frame = new TeamTable();
frame.setUndecorated(true);
frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
frame.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
System.exit(0);
frame.setVisible(true);
* Define the look/content for a cell in the row header
* In this instance uses the JTables header properties
class RowHeaderRenderer extends JLabel implements ListCellRenderer {
* Constructor creates all cells the same
* To change look for individual cells put code in
* getListCellRendererComponent method
RowHeaderRenderer(JTable table) {
JTableHeader header = table.getTableHeader();
setOpaque(true);
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
setHorizontalAlignment(CENTER);
setForeground(header.getForeground());
setBackground(header.getBackground());
setFont(header.getFont());
* Returns the JLabel after setting the text of the cell
public Component getListCellRendererComponent( JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
setText((value == null) ? "" : value.toString());
return this; -
Bullet character in imported TXT file
I am importing an external TXT file into a dynamic text box
in my SWF file using Actionscript (see AS below).
I want the text to read as a bulleted list.
I tried typing the bullet character (Option + 8 on Mac), but
this gave me Yen symbols when I previewed the movie.
Then I tried the HTML code <UL>, <LI>, etc.,
which just showed exactly as typed when previewed.
I also tried the HTML code for this character (•)
but this also showed exactly as typed when previewed.
How do I create the bullet character in Flash? Is there a
reference for creating all types of special characters in Flash?
Or is there a simple way to create a bulleted list?
Many Thanks,
Nathan
My system specifications:
Mac OS 10.4.10
Flash CS3for html content you would need to use external_txt.htmlText
= event.target.data;. also embed the basic font and the specific
"•" character
if you wanted to go the character code route you would have
to strip the character code from the string first and replace it
with a bullet. -
Can I import html files into Buzzword?
Can I import html files into Buzzword?
Thank you for your post.
Buzzword lets you import Microsoft Word (DOC, DOCX), plain text (TXT), Rich Text Format (RTF), Word 2003 XML, and Open Document Format (.odt) files. (Font substitution and other formatting changes sometimes occur on import, depending on the content of the document.) You'll need to convert your HTML file to one of the supported file types before importing to Buzzword.
Kind Regards,
Michelle -
Importing Text Files into Notes
Having trouble reading imported text. I have IPod nano 3rd gen. It is checked to enable disc use. When I drop a .txt file into notes folder, then eject IPod, I can see the document titles in IPod/notes however, text displays as code (alot of 0's &1's and other garbled letters). Does anyone know why this happens and how I can solve this? I would greatly appreciate any suggestions.
ThanksThe files MUST be plain text files (possible sich text format as well) but not Word Documents and stuff like that. Simply taking a Word document and changing the extension from .doc to .txt won't do it for you, if that is what you tried.
Patrick -
Can't import prores files into Premiere Pro CC or SpeedGrade CC
Can't import prores files into Premiere Pro CC or SpeedGrade CC. But I can into After Effects CC.
I also can't export to DNxHD files to an MXF file either.
I do have latest Quicktime Pro installed and I also have Avid Media Composer and the other pieces of the Avid package.
Conflict?I only have one account on the computer and it has Administrator priveleges. What I am doing to make it work is opening the application using the "Run as Administrator" command (e.g., right click application shortcut on desktop, choose "Run as Administrator"). I am not a Windows guru but I would guess there is something different between opening an Application with a user that has Administrator priveleges and opening an Application choosing "Run as Administrator". Also, your answer still does not address the fact that I can't use my jog wheel.
Anyone else have some ideas? -
Import .icbu file into iCal
My Apple ID is linked to an e-mail address which is deleted by provider, due to move to another town. My Calendar and Notes are in iCloud under the e-mail address which has been deleted. I made an .icbu file but cannot import the file into Calendar under a different Apple ID (which is the secondary e-mail address of my Apple ID of the deleted e-mail address).
Any way to import the .icbu file into Calendar with the content not linked to my deleted e-mail Apple ID?
Thanks in advance, Hans.When I Import the .icbu file into Calendar it shows all my entries but in the Calendar which does not sync with iCloud.
Right you just imported the data, and the data was imported. If you want it to sync you have to turn that feature on.
I cannot make a new password since Apple ID does not accept my date of birth... and Apple ID cannot send any notification to my deleted e-mail address... nor does it make use of my secondary e-mail address in Apple ID.
You should not need a new password. Just deleteing the email address you used for your AppleID does not change anything about your AppleID account. You would just need to login and change the account email address to your new one. When did your AppleId stop working? Or had you forgotten it. You could try contacting Apple's customer service, but I doubt they will be able to do anything. If you have really lost access to that AppleId then you might just have to make a new one and start over. Sorry I know, not a great answer.
I made secondary e-mail address with the Apple ID of my deleted (primary) e-mail address
So you went back to the same service and recreated the same user Id that was already deleted? So you have the same email address again? -
Importing AVI files into Final cut creates a pop
How can I stop getting a popping sound when I import AVI files into Final Cut. I figured it must be the type of file itself but I cant seem to find a free converter to convert my AVIs into what ever is need (which is what? .mov files?)
Please helpThe very basics of non-linear editing is to know what video and audio codecs your particular NLE works with natively. FCP works with many video codecs but only a few audio codecs. Typically it works best with AIFF at 48khz, 16 bit.
You can find out all the various native codecs and formats in the User's Manual, Help Files or by looking through the Easy Setup list.
FWIW, both AVI and MOV are not really codecs at all; they are both merely containers that could contain video and audio made from any number of codecs. So saying you have an AVI file or a MOV file is kind of like saying you have a car ... it doesn't really tell anyone much at all.
Both QuickTime Pro and Compressor (which you most likely already have installed) should be able to convert to a native codec for use in FCP.
-DH -
Import Text Files Into Apple Notes?
Hello,
Is there a way for me to automate importing text files into Apple Notes? I can certainly do this manually via copy/paste, but have over 700 files to transfer.
Peace,
Dr. Z.Automator is Apple's simple way to do tasks like this, but Notes app doesn't have any actions for this so I assume you need to use Applescript to do this. Double check Automator - I am on 10.9 & maybe 10.10 added support for Notes in Automator? Enter 'Note' in the search field to see if Automator can make new Notes.
There is an example for making notes at…
http://www.macosxautomation.com/applescript/notes/04.html
See the "Create New Stylized Note" script <- click script icon to download it, copy & paste seems to fail because of how the browser displays characters.
You would need to adapt that script to import from the text files.
I'm not sure you really want to do that anyway - Notes app has such poor support that putting serious data into it looks like a mistake - how difficult will it be to export data when Apple eventually abandon it? It seems like a toy app to me for new iPhone users, it;s unclear if it will ever be able to compete with other options. There are third party apps to export from Notes.app, but why rely on third parties? A notes app should allow you to import & export your data!
Notational Velocity seems like a better choice…
http://notational.net/
It will handle notes as text files if you desire, so you can store them in Dropbox if you want. You can also set it to sync to Simplenote on iOS.
http://simplenote.com/
If you need images within notes or text styling you could use Evernote or one of the many other notes apps.
Sorry to sound so negative on Notes.app, it's OK but I don't think its the best place to put over 700 notes.
Maybe you are looking for
-
G/L accounts with quantities
Hello experts, I would like to select all G/L accounts which have posted quantities. Could you give me advice how to do it in the most performant way. There are two tables where I have to search: BSEG(?) and COSP. Thank you in advance. Best regards P
-
Hi Friends, I am trying to get a printout through FBZ5 for an ACH format (Payment method - T) for a new company code. Facing the following error, Select either a payment transfer medium or a DME Message no. F0067 Diagnosis Payment transfer media can
-
I have a problem with buying apps in itunes Store. When you purchase the application fails payment. Asked to update the map. I have 2 credit cards with a positive balance. In what could be the reason?
-
WD ABAP ALV: filter in unsorted columns settings
Hello WD ABAP experts, in a WD ABAP ALV Table, in settings, it is possible to filer in the "hidden columns" section for the column name. Unfortunately this filter is not possible in the "Sort" section, where I get only a list of unsorted columns. In
-
Every time the sign in box pops up email adresses of different people I know pops up in the ID box. I dont have those people in any of my contacts and I didnt get any of my music from them. I have way to many music to authorize every song. I think so